public static string loadRegion(string constId) { string JSON = ""; VoterBLL voterObj = new VoterBLL(); voterObj.constId = constId; DataTable dtTemp = voterObj.getRegionMaster(); JSON = JsonConvert.SerializeObject(dtTemp, Newtonsoft.Json.Formatting.Indented); return(JSON); }
public static string loadBooth(string areaId) { string JSON = ""; VoterBLL voterObj = new VoterBLL(); voterObj.areaId = areaId; DataTable dtTemp = voterObj.getBoothMasterByAreaId(); JSON = JsonConvert.SerializeObject(dtTemp, Newtonsoft.Json.Formatting.Indented); return(JSON); }
public static string loadArea(string regId) { string JSON = ""; VoterBLL voterObj = new VoterBLL(); voterObj.regId = regId; DataTable dtTemp = voterObj.getAreaMasterByRegionId(); JSON = JsonConvert.SerializeObject(dtTemp, Newtonsoft.Json.Formatting.Indented); return(JSON); }
//deleteVotersById public bool deleteVotersById(VoterBLL votObj) { string qry = "DELETE FROM votermaster WHERE votersId in (" + votObj.voterId + ")"; int rec = executeQuery(qry); if (rec > 0) { return(true); } else { return(false); } }
//updateVoterMaster public bool updateVoterMaster(VoterBLL votObj) { using (MySqlCommand cmd = new MySqlCommand()) { cmd.CommandText = "updateVoterMaster"; cmd.Parameters.AddWithValue("_votersId", voterId); cmd.Parameters.AddWithValue("_name", name); cmd.Parameters.AddWithValue("_address", address); cmd.Parameters.AddWithValue("_comId", comId); cmd.Parameters.AddWithValue("_boothId", boothId); cmd.Parameters.AddWithValue("_profilePic", profilePic); cmd.Parameters.AddWithValue("_primaryContactNo", mobile1); cmd.Parameters.AddWithValue("_secondryContactNo", mobile2); return(dalObj.getExecuteData(cmd, out errMsg)); } }
//Add Voters public int saveVotersMaster(VoterBLL votObj) { try { int rec = 0; int cnt = 0; string query = "INSERT INTO votermaster (name,address,comId,boothId,profilePic,primaryContactNo,secondryContactNo,dateCreated,dateModified) VALUES\n"; for (int i = 0; i < votObj.dtExcelData.Rows.Count; i++) { query = query + string.Format(@"('{0}','{1}',{2},{3},'default.png','{4}','{5}',NOW(),NOW()),", votObj.dtExcelData.Rows[i]["Name"], votObj.dtExcelData.Rows[i]["Address"], votObj.comId, votObj.boothId, votObj.dtExcelData.Rows[i]["Phone1"], votObj.dtExcelData.Rows[i]["Phone2"]); if ((i + 1) % 100 == 0) { query = query.TrimEnd(','); rec = executeQuery(query); if (rec > 0) { cnt = cnt + rec; query = "INSERT INTO votermaster (name,address,comId,boothId,profilePic,primaryContactNo,secondryContactNo,dateCreated,dateModified) VALUES\n"; } } } if (!string.IsNullOrEmpty(query)) { query = query.TrimEnd(','); rec = executeQuery(query); if (rec > 0) { cnt = cnt + rec; } } return(cnt); } catch (Exception ex) { return(0); } }