/// <summary> /// 個人會員匯入 /// </summary> protected void SetMemberPInDate(DataSet dsMemberPInDate) { //先刪除foodorg的memberP的所有資料 //取得所有資料 if (dsMemberPInDate.Tables[0].Rows.Count > 0) { lbState.Invoke((Action <string>)SetStatus, "從access取個人會員資料移到FoodOrg"); lbl_MemberPAll.Invoke((Action <string>)SetMemberPAll, dsMemberPInDate.Tables[0].Rows.Count.ToString()); int i = 0; foreach (DataRow dr in dsMemberPInDate.Tables[0].Rows) { string strMemberPID = SetMemberGed(dr["MARK"].ToString()); MMemberP mod = new BMemberP().GetModel(strMemberPID); if (mod != null) { if (dr["INDATE"].ToString().Length != 0) { try { mod.RegisterDate = DateTime.Parse(dr["INDATE"].ToString()); } catch { string s = ""; } } new BMemberP().Edit(mod); i++; } lbMemberPCount.Invoke((Action <int>)SetMemberP, i); } } }
/// <summary> /// 檢查會員是否已付過費用 如果已繳過則將status改為正常 /// </summary> private void MemberCheckStatus() { int intTWYear = new BTWYear().GetTop1().TWYear; //找出所有待繳費的使用者 //個人會員 BMemberP bllP = new BMemberP(); List <MMemberP> listP = bllP.GetListByWaitPay(); foreach (MMemberP mod in listP) { if (mod.Status == "待繳費") { if (new BOrder().CheckMemberFeePay(mod.MemberPID, "P") > 0 && new BOrder().CheckYearFeePay(mod.MemberPID, "P", mod.MemberClass, intTWYear) > 0) { mod.Status = "正常"; new BMemberP().Edit(mod); } } } //團體會員 BMemberG bllG = new BMemberG(); List <MMemberG> listG = bllG.GetListByWaitPay(); foreach (MMemberG mod in listG) { if (mod.Status == "待繳費") { if (new BOrder().CheckMemberFeePay(mod.MemberGID, "G") > 0 && new BOrder().CheckYearFeePay(mod.MemberGID, "G", mod.MemberClass, intTWYear) > 0) { mod.Status = "正常"; new BMemberG().Edit(mod); } } } }
/// <summary> /// 費用匯入 /// </summary> protected void SetFeeTrans(DataSet dsFee) { lbState.Invoke((Action <string>)SetStatus, "從access取費用資料移到FoodOrg"); lbl_VoteAll.Invoke((Action <string>)SetVoteAll, dsFee.Tables[0].Rows.Count.ToString()); int intFeeCount = 0; //TB_Fee在轉的時後,把orderid 放到新的TB_FeeP的時後,把OrderID放到Remark foreach (DataRow dr in dsFee.Tables[0].Rows) { if (!(dr["MemberID"].ToString().IndexOf("-1") > 0)) { MFeeP mod = new MFeeP(); mod.MemberPID = SetMemberGed(dr["MemberID"].ToString()); mod.TWYear = SetTWYear(dr["Period"].ToString()); if (dr["Store"].ToString().Length == 0) { mod.PayType = "虛擬帳戶"; } else { mod.PayType = "超商條碼"; } //Access為總計 只有三種金額 400 500 900 int intFeeTotalCount = Convert.ToInt32(dr["Fee"].ToString()); //switch(intFeeCount) //{ // case 400: // // // mod.Fee1 = 0; // break; // case 500: // // // mod.Fee1 = 0; // break; // case 900: // // // mod.Fee1 = 0; // break; //} int intPayType = Convert.ToInt32(dr["FeeType"].ToString()); switch (intPayType) { //常年會費+年會出席費 case 1: //200 400 500 600 900 有這幾種價格 mod.Fee1 = 0; switch (intFeeTotalCount) { case 200: mod.Fee1 = 0; mod.Fee2 = 200; mod.Fee3 = 0; break; case 400: // if (mod.MemberPID.Length == 0) { mod.Fee1 = 0; mod.Fee2 = 400; mod.Fee3 = 0; } else { MMemberP Member = new BMemberP().GetModel(mod.MemberPID); if (Member == null) { mod.Fee1 = 0; mod.Fee2 = 400; mod.Fee3 = 0; } else { if (Member.MemberClass == "永久") { mod.Fee1 = 0; mod.Fee2 = 0; mod.Fee3 = 400; } else { mod.Fee1 = 0; mod.Fee2 = 200; mod.Fee3 = 200; } } } break; case 500: // mod.Fee1 = 0; if (mod.MemberPID == "10980" | mod.MemberPID == "11048" | mod.MemberPID == "11083" | mod.MemberPID == "05862") { mod.Fee2 = 300; mod.Fee3 = 200; } else { mod.Fee2 = 500; mod.Fee3 = 0; } break; case 600: // mod.Fee1 = 0; mod.Fee2 = 200; mod.Fee3 = 400; break; case 900: // mod.Fee1 = 0; mod.Fee2 = 500; mod.Fee3 = 400; break; } break; //常年會費 case 2: // mod.Fee1 = 0; mod.Fee2 = intFeeTotalCount; mod.Fee3 = 0; break; //年會出席費 case 3: // mod.Fee1 = 0; mod.Fee2 = 0; mod.Fee3 = intFeeTotalCount; break; } mod.PayDate = Convert.ToDateTime(dr["PayDate"].ToString()); mod.Remark = dr["OrderID"].ToString(); //dr["RecDate"].ToString(); new BFeeP().Add(mod); intFeeCount++; lbVoteCount.Invoke((Action <int>)SetFee, intFeeCount); } } }
/// <summary> /// 個人會員匯入 /// </summary> protected void SetMemberPTrans(DataSet dsMemberP) { //先刪除foodorg的memberP的所有資料 //取得所有資料 List <MMemberP> liFoodMemberP = new BMemberP().GetListByKeyword("", "全部", "全部", "全部"); lbState.Invoke((Action <string>)SetStatus, "刪除FoodOrg個人會員資料"); lbl_MemberPAll.Invoke((Action <string>)SetMemberPAll, liFoodMemberP.Count.ToString()); int intDelP = 0; foreach (MMemberP mod in liFoodMemberP) { new BMemberP().Del(mod.MemberPID); intDelP++; lbMemberPCount.Invoke((Action <int>)SetMemberP, intDelP); } //刪除所有Specialty new BMemberP().DelAllSpecialty(); if (dsMemberP.Tables[0].Rows.Count > 0) { lbState.Invoke((Action <string>)SetStatus, "從access取個人會員資料移到FoodOrg"); lbl_MemberPAll.Invoke((Action <string>)SetMemberPAll, dsMemberP.Tables[0].Rows.Count.ToString()); int i = 0; foreach (DataRow dr in dsMemberP.Tables[0].Rows) { MMemberP mod = new MMemberP(); if (!(dr["MARK"].ToString().IndexOf("-1") > 0)) { mod.MemberPID = SetMemberGed(dr["MARK"].ToString()); if (dr["MemberPassword"].ToString().Length == 0) { mod.MemberPassword = TestLibrary.Common.Security.Encrypt("000000"); } else { mod.MemberPassword = dr["MemberPassword"].ToString(); } mod.NameC = dr["C_NAME"].ToString(); mod.NameE = dr["E_NAME"].ToString(); mod.Email = dr["EMAIL"].ToString(); mod.PID = dr["PID"].ToString(); //SQLUtil.GetDateTime(dr["BIRTH"]); //mod.Birthday = Convert.ToDateTime(dr["BIRTH"].ToString()); //這兩項 有可能為null if (dr["BIRTH"].ToString().Length != 0) { mod.Birthday = Convert.ToDateTime(dr["BIRTH"].ToString()); } if (dr["INDATE"].ToString().Length != 0) { mod.RegisterDate = DateTime.Parse(dr["INDATE"].ToString()); } else { mod.RegisterDate = DateTime.Now; } mod.RegisterDate = DateTime.Now; mod.Sex = dr["SEX"].ToString(); mod.Native = dr["NATIVE"].ToString(); string strMemberClass = "學生"; switch (dr["MCLASS"].ToString()) { case "永": strMemberClass = "永久"; break; case "普": strMemberClass = "普通"; break; } mod.MemberClass = strMemberClass; mod.School = dr["EDUC"].ToString(); mod.CollegeDepartment = ""; mod.Education = dr["EDUCATION"].ToString(); mod.Job = dr["WORK"].ToString(); mod.JobTitle = dr["TITLE"].ToString(); mod.Student = bool.Parse(dr["STUDENT"].ToString()); //原本沒有手機 //mod.Mobile = dr["Mobile"].ToString(); mod.Mobile = ""; mod.TEL = dr["TEL"].ToString(); mod.FAX = dr["FAX"].ToString(); mod.ZipCodeH = dr["ZONE"].ToString(); mod.CityH = dr["ADDR_CITY"].ToString().Replace("台", "臺"); mod.AreaH = ""; mod.AddressH = dr["HOME"].ToString(); mod.ZipCode = ""; mod.City = ""; mod.Area = ""; mod.Address = ""; mod.SchoolConsent = ""; mod.StudentIDCard = ""; mod.StudentIDCardFileType = ""; mod.Memo = dr["MEMO"].ToString(); //mod.Status = dr["Status"].ToString(); mod.Status = "正常"; mod.EDM = Convert.ToBoolean(dr["RECEIVE_MAIL"].ToString()); mod.CreateUser = "******"; mod.UpdateUser = "******"; new BMemberP().Add(mod); i++; lbMemberPCount.Invoke((Action <int>)SetMemberP, i); } } } }