public MembersData SelectMembersDataAll(string mCode) { SqlHandling sh = new SqlHandling("M_Members"); DataTable dt = sh.SelectAllData("WHERE MemberCode = '" + mCode + "'"); if (dt == null) { return(null); } MembersData rmd = new MembersData(dt.Rows[0]); return(rmd); }
public MembersData[] SelectMembersDataAll() { SqlHandling sh = new SqlHandling("M_Members"); DataTable dt = sh.SelectAllData("WHERE (MemberType = 0 OR MemberType = 3) AND Enrollment = 0 ORDER BY MemberCode"); if (dt == null) { return(null); } MembersData[] rmdA = new MembersData[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { rmdA[i] = new MembersData(dt.Rows[i]); } return(rmdA); }
public int CreateCostReportDataByCSVData(string fileName, string officeCode) { int procCount = 0; int repoDate; string[] codeArray = new string[2]; int[] getaArray = new int[] { 0, 300000, 500000, 700000 }; int geta = getaArray[Conv.OfficeCodeIndex(officeCode)]; StringUtility sutil = new StringUtility(); MembersData md = new MembersData(); CostReportData crd = new CostReportData(); try { using (var streamReader = new StreamReader(fileName, System.Text.Encoding.Default)) { while (!streamReader.EndOfStream) { var line = streamReader.ReadLine(); var valArray = line.Split(','); if (!DHandling.IsNumeric(Convert.ToString(valArray[0]))) { continue; } if (Convert.ToInt32(valArray[4]) > 900000) { continue; } crd.SlipNo = Convert.ToInt32(valArray[4]) + geta; repoDate = (Convert.ToInt32(valArray[1]) == 0) ? Convert.ToInt32(valArray[2]) + 19880000 : Convert.ToInt32(valArray[2]) + 20000000; crd.ReportDate = DateTime.ParseExact(Convert.ToString(repoDate) + "000000", "yyyyMMddHHmmss", null); crd.TaskCode = Convert.ToString(valArray[5]); crd.ItemCode = Convert.ToString(valArray[12]); crd.Item = Convert.ToString(valArray[14]); crd.Quantity = Convert.ToDecimal(valArray[18]); crd.Unit = Convert.ToString(valArray[19]); crd.UnitPrice = Convert.ToDecimal(valArray[20]); crd.Cost = Convert.ToDecimal(valArray[21]); crd.Note = Convert.ToString(valArray[27]); TaskData td = new TaskData(); td = td.SelectTaskData(crd.TaskCode); if (td != null) { crd.CustoCode = td.PartnerCode; crd.SalesMCode = td.SalesMCode; } crd.Subject = sutil.SubstringByte(crd.ItemCode, 0, 1); crd.SubCoCode = (crd.Subject == "F") ? crd.ItemCode : ""; crd.MemberCode = (Convert.ToInt32(valArray[9]) < 100) ? "0" + Convert.ToString(valArray[9]) : Convert.ToString(valArray[9]); crd.LeaderMCode = (Convert.ToInt32(valArray[9]) < 100) ? "0" + Convert.ToString(valArray[9]) : Convert.ToString(valArray[9]); // 事業所および部門 crd.OfficeCode = officeCode; crd.Department = (crd.OfficeCode == "H") ? Conv.tdHList[Conv.DepartmentCodeIndex(sutil.SubstringByte(crd.TaskCode, 0, 1))] : Conv.tdBList[Conv.DepartmentCodeIndex(sutil.SubstringByte(crd.TaskCode, 0, 1))]; if (crd.MemberCode != "" && crd.MemberCode == holdMCode) { crd.Department = holdDept; } else { codeArray = md.SelectMembersOffice(crd.MemberCode); if (codeArray != null) { if (codeArray[0] == crd.OfficeCode) { crd.Department = codeArray[1]; } } holdMCode = crd.MemberCode; holdDept = crd.Department; } crd.AccountCode = "SYO"; crd.CoTaskCode = ""; if (crd.ExistenceSlipNo()) { continue; } // 項目移送 if (!crd.InsertCostReport()) { return(0); } procCount++; } } } catch (Exception ex) { MessageBox.Show(ex.Message); procCount = -1; } return(procCount); }