///
///基础数据导入///
private voidLoadBasicData()
{this.NowCount = 0;this.AllCount = 0;this.hasResult = false;try{
DelegateShowProssBar mi= newDelegateShowProssBar(ShowProcessBar);this.BeginInvoke(mi, new object[] { "导入基础数据", "导入数据", true});
Thread.Sleep(1000);//等待进度条弹出
object[] objPar = new object[] { 0, "导入数据...\r"};objectobjReturn;this.Invoke(this.myIncrease, objPar);this.AllCount =dt.Rows.Count;this.wpf.SetMaxValue(this.AllCount);
objPar= new object[] { this.NowCount, "开始导入数据...\r"};this.Invoke(this.myIncrease, objPar);foreach (DataRow dr indt.Rows)
{this.NowCount++;//校区
XX0103BLL bll_xx0103 = newXX0103BLL();
XX0103Model.Base model_xx0103= newXX0103Model.Base();if (bll_xx0103.Exists("", dr["校区编号"].ToString(), dr["校区名称"].ToString()) == false)
{//没有校区添加校区
model_xx0103.XQBH = dr["校区编号"].ToString();
model_xx0103.XQMC= dr["校区名称"].ToString();
bll_xx0103.Add(model_xx0103);
}//部门
XX0301BLL bll_xx0301 = newXX0301BLL();
XX0301Model.Base model_xx0301= newXX0301Model.Base();if (bll_xx0301.Exists("", dr["校区编号"].ToString(), dr["部门编号"].ToString(), dr["部门名称"].ToString()) == false)
{
model_xx0301.BMBH= dr["部门编号"].ToString();
model_xx0301.BMMC= dr["部门名称"].ToString();
model_xx0301.XQBH= dr["校区编号"].ToString();
bll_xx0301.Add(model_xx0301);
}//专业
JX01BLL bll_jx01 = newJX01BLL();
JX01Model.Base model_jx01= newJX01Model.Base();if (bll_jx01.Exists("", dr["专业编号"].ToString()) == false)
{
model_jx01.ZYBH= dr["专业编号"].ToString();
model_jx01.ZYMC= dr["专业名称"].ToString();
model_jx01.BMBH= dr["部门编号"].ToString();
model_jx01.CC= dr["层次"].ToString();
bll_jx01.Add(model_jx01);
}//用户
CustomerBLL bll_customer = newCustomerBLL();
CustomerModel.Base model_customer= newCustomerModel.Base();if (bll_customer.Exists("", dr["考生号"].ToString()) == false)
{
model_customer.OutID= dr["考生号"].ToString();
model_customer.CardNo= int.Parse(dr["卡号"].ToString());
model_customer.Name= dr["姓名"].ToString();
model_customer.CardSN= int.Parse(dr["换卡序号"].ToString());
model_customer.Sex= dr["性别"].ToString();
model_customer.CustomerTypeID= int.Parse(dr["客户类别"].ToString());
model_customer.NJ= dr["年级"].ToString();
model_customer.ZYBH= dr["专业编号"].ToString();
model_customer.CardStatusID= int.Parse(dr["卡状态码"].ToString());
model_customer.IDCardNo= dr["身份证号"].ToString();
model_customer.CardTypeID= int.Parse(dr["卡类别码"].ToString());
model_customer.AddTime=DateTime.Now;
bll_customer.Add(model_customer);
}if (!this.hasResult)
{
objPar= new object[] { this.NowCount, ""};
objReturn= this.Invoke(this.myIncrease, objPar);
hasResult=((WaitProcessFormEx.ResStruct)objReturn).HasResult;bool canceled =((WaitProcessFormEx.ResStruct)objReturn).Canceled;if(hasResult)
{if (this.NowCount == this.AllCount)
{//showResult(true, "完成! ");
}else{
showResult(false, canceled ? "操作被取消!" : "导入未完成!");return;
}
}
}else{
}
}
objPar= new object[] { this.NowCount, "数据导入完成!"};this.Invoke(this.myIncrease, objPar);
}catch{
Error("错误", "数据导入错误");
}
}