public XmlDocument getLocalBodies(int district, int taluka, int localBodyType) { try { XmlDocument xmlDocument = new XmlDocument(); OthersDAL othersDal = new OthersDAL(); othersDal.getLocalBody(taluka, district, localBodyType); if (othersDal.isError == CommonCode.OK) { if (othersDal.Data != null && othersDal.Data.Tables[0].Rows.Count != 0) { othersDal.Data.Tables[0].TableName = "LocalBodies"; XmlDataDocument xmlDataDocument = new XmlDataDocument(othersDal.Data); XmlElement element = xmlDataDocument.DocumentElement; return(xmlDataDocument); } else { CommonCode commonCode = new CommonCode(); return(commonCode.ErrorXml(CommonCode.DATA_NOT_FOUND)); } } else { CommonCode commonCode = new CommonCode(); return(commonCode.ErrorXml(CommonCode.FAIL)); } } catch { CommonCode commonCode = new CommonCode(); return(commonCode.ErrorXml(CommonCode.SQL_ERROR)); } }
public XmlDocument getDistrict(int stateId) { try { XmlDocument xmlDocument = new XmlDocument(); OthersDAL othersDal = new OthersDAL(); othersDal.getDistrict(stateId); if (othersDal.isError == CommonCode.OK) { if (othersDal.Data != null && othersDal.Data.Tables[0].Rows.Count != 0) { othersDal.Data.Tables[0].TableName = "District"; XmlDataDocument xmlDataDocument = new XmlDataDocument(othersDal.Data); XmlElement element = xmlDataDocument.DocumentElement; return(xmlDataDocument); } else { CommonCode commonCode = new CommonCode(); return(commonCode.ErrorXml(CommonCode.DATA_NOT_FOUND)); } } else { CommonCode commonCode = new CommonCode(); return(commonCode.ErrorXml(CommonCode.FAIL)); } } catch { CommonCode commonCode = new CommonCode(); return(commonCode.ErrorXml(CommonCode.SQL_ERROR)); } }
private void lbImportRegForm_Click(object sender, EventArgs e) { var selectedRow = dataGridViewX1.SelectedRows[0]; if (selectedRow == null) { return; } var matchId = selectedRow.Cells[0].Value.ToString(); var selectedFolder = string.Empty; FolderBrowserDialog folderBrowser = new FolderBrowserDialog(); folderBrowser.Description = "请选择一个文件夹,确认后会将文件夹内所有报名文件导入系统"; if (folderBrowser.ShowDialog() == DialogResult.OK) { selectedFolder = folderBrowser.SelectedPath; } if (string.IsNullOrWhiteSpace(selectedFolder)) { return; } var root = new DirectoryInfo(selectedFolder); var files = root.GetFiles(); var filesCount = files.Count(); // 获取文件数量 // 读取文件,将数据写入到数据库中 var allAthletes = new List <AthleteModel>(); var allOthers = new List <OthersModel>(); foreach (var file in files) { try { var result = ExcelHelperImport.GetFileInfo(file, matchId); allAthletes.AddRange(result.Athletes); allOthers.AddRange(result.Others); } catch (Exception ex) { MessageBox.Show($"{file.FullName} \n 文件异常,请检查是否被打开或者文件是否符合导入格式。 Exception:{ex}"); return; } } // 将所有的运动员信息存入到数据库中 AthletesDAL.InsertBatch(allAthletes); OthersDAL.InsertBatch(allOthers); this.lbImportRegForm.Text = "重新导入报名表(已导入)"; MessageBox.Show($"所有报名表已经导入成功!共{filesCount}个文件。"); }
public string insertBogusVoters(string information) { try { OthersDAL otherdal = new OthersDAL(); string[] voers = information.Split(new char[] { '*' }); return(otherdal.insertbogusvoters(voers[0], voers[1], voers[2], voers[3])); } catch (Exception) { return(CommonCode.ERROR.ToString()); } }
public string GetJunior(string mobileNo) //Change Here { try { string[] uregid = mobileNo.Split('$'); mobileNo = objenc.DecryptInteger(uregid[0], uregid[1]); OthersDAL dal = new OthersDAL(); return(dal.ImigiateJuniour(mobileNo)); } catch { return("0"); } }
public string GetUserStatus(string localBody, string wardno, string mobileno, string boothno) { try { OthersDAL dal = new OthersDAL(); DataSet ds = dal.GetJuniiours(mobileno); string juniours = ""; if (ds.Tables[0].Rows.Count != 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { juniours += ",'" + ds.Tables[0].Rows[i][1].ToString() + "'"; } juniours = juniours.Substring(1, juniours.Length - 1); PollingDataDAL podal = new PollingDataDAL(); DataSet ds1 = podal.GetUserStatus(juniours, wardno, boothno, localBody); juniours = ""; if (ds1.Tables[0].Rows.Count != 0) { for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { juniours += "*" + ds1.Tables[0].Rows[i][3].ToString() + "*" + ds1.Tables[0].Rows[i][4].ToString(); } juniours = juniours.Substring(1, juniours.Length - 1); } else { juniours += "" + CommonCode.DATA_NOT_FOUND.ToString(); } } else { juniours += "" + CommonCode.DATA_NOT_FOUND; } return(juniours); } catch (Exception) { return("" + CommonCode.ERROR); } }
public string GetResponsibility(string localBody, string wardno, string mobileno) { try { OthersDAL dal = new OthersDAL(); DataSet ds = dal.GetJuniiours(mobileno); string juniours = ""; if (ds.Tables[0].Rows.Count != 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { juniours += ",'" + ds.Tables[0].Rows[i][1].ToString() + "'"; } juniours = juniours.Substring(1, juniours.Length - 1); DataSet ds1 = dal.GetResponsibility(juniours, localBody, wardno); juniours = ""; if (ds1.Tables[0].Rows.Count != 0) { for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) { juniours += "*" + ds1.Tables[0].Rows[i][1].ToString() + "*" + ds1.Tables[0].Rows[i][4].ToString() + "*" + (ds.Tables[0].AsEnumerable().Where(a => a.Field <string>("USER_MOBILE") == ds1.Tables[0].Rows[i][1].ToString()).Select(r => r.Field <string>("Name")).First <string>()); } juniours = juniours.Substring(1, juniours.Length - 1); } else { juniours += "" + CommonCode.DATA_NOT_FOUND.ToString(); } } else { juniours += "" + CommonCode.DATA_NOT_FOUND; } return(juniours); } catch (Exception) { return("" + CommonCode.ERROR); } }