public OutPutJsonBeatModel InsertBeatToMasterDataTagging(string companyCode, List <MasterDataTaggedModel> lstTaggedData) { OutPutJsonBeatModel result = new OutPutJsonBeatModel(); try { DataTable dtTaggedData = new DataTable(); dtTaggedData.Columns.Add("Company_Code", typeof(string)); dtTaggedData.Columns.Add("Company_Id", typeof(int)); dtTaggedData.Columns.Add("Region_Code", typeof(string)); dtTaggedData.Columns.Add("Beat_Code", typeof(string)); dtTaggedData.Columns.Add("Customer_Code", typeof(string)); dtTaggedData.Columns.Add("Customer_Entity_Type", typeof(string)); dtTaggedData.Columns.Add("Created_By", typeof(string)); dtTaggedData.Columns.Add("Doctor_Name", typeof(string)); dtTaggedData.Columns.Add("MappedStatus", typeof(int)); dtTaggedData.Columns.Add("Mapping_Status", typeof(string)); if (lstTaggedData != null && lstTaggedData.Count > 0) { for (int i = 0; i < lstTaggedData.Count; i++) { dtTaggedData.Rows.Add(lstTaggedData[i].Company_Code, lstTaggedData[i].Company_Id, lstTaggedData[i].Region_Code, lstTaggedData[i].Beat_Code, lstTaggedData[i].Customer_Code, lstTaggedData[i].Customer_Entity_Type, lstTaggedData[i].Created_By, lstTaggedData[i].Doctor_Name, lstTaggedData[i].MappedStatus, lstTaggedData[i].Mapping_Status); } } result = _objBeat.InsertBeatToMasterDataTagging(companyCode, dtTaggedData, lstTaggedData); } catch (Exception ex) { throw; } return(result); }
public OutPutJsonBeatModel UpdateApproveorUnApproveBeat(string companyCode, int companyId, string regionCode, List <BeatPlanModel> lstBeatApprorUnAppr) { OutPutJsonBeatModel result = new OutPutJsonBeatModel(); try { DataTable dtApprorUnAppr = new DataTable(); dtApprorUnAppr.Columns.Add("Company_Code", typeof(string)); dtApprorUnAppr.Columns.Add("Company_Id", typeof(int)); dtApprorUnAppr.Columns.Add("Region_Code", typeof(string)); dtApprorUnAppr.Columns.Add("Beat_Code", typeof(string)); dtApprorUnAppr.Columns.Add("Beat_Status", typeof(int)); dtApprorUnAppr.Columns.Add("Remarks", typeof(string)); dtApprorUnAppr.Columns.Add("Created_By", typeof(string)); if (lstBeatApprorUnAppr != null && lstBeatApprorUnAppr.Count > 0) { for (int i = 0; i < lstBeatApprorUnAppr.Count; i++) { dtApprorUnAppr.Rows.Add(companyCode, companyId, lstBeatApprorUnAppr[i].Region_Code, lstBeatApprorUnAppr[i].Beat_Code, lstBeatApprorUnAppr[i].Beat_Status, lstBeatApprorUnAppr[i].Remarks, lstBeatApprorUnAppr[i].Created_By); } } result = _objBeat.UpdateApproveorUnApproveBeat(companyCode, companyId, regionCode, lstBeatApprorUnAppr, dtApprorUnAppr); } catch (Exception ex) { throw; } return(result); }
public JsonResult InsertBeatToMasterDataTagging(string companyCode, string _lstTaggingDataDetails) { List <MasterDataTaggedModel> _lstTaggedData = new List <MasterDataTaggedModel>(); OutPutJsonBeatModel result = new OutPutJsonBeatModel(); _lstTaggedData = (List <MasterDataTaggedModel>)JsonConvert.DeserializeObject(_lstTaggingDataDetails, typeof(List <MasterDataTaggedModel>)); result = _ObjBeat.InsertBeatToMasterDataTagging(companyCode, _lstTaggedData); return(Json(result, JsonRequestBehavior.AllowGet)); }
public OutPutJsonBeatModel InsertBeatPlanDetails(string companyCode, string regionCode, int CompanyId, BeatPlanModel _ObjBeatData, int Weeknumber, string Weekday) { OutPutJsonBeatModel result = new OutPutJsonBeatModel(); try { DataTable dtSFC = new DataTable(); dtSFC.Columns.Add("Company_Code", typeof(string)); dtSFC.Columns.Add("Company_Id", typeof(int)); dtSFC.Columns.Add("Region_Code", typeof(string)); dtSFC.Columns.Add("From_Region_Name", typeof(string)); dtSFC.Columns.Add("To_Region_Name", typeof(string)); dtSFC.Columns.Add("Distance_Fare_Code", typeof(string)); dtSFC.Columns.Add("Route_Way", typeof(string)); dtSFC.Columns.Add("Travel_Mode", typeof(string)); dtSFC.Columns.Add("Created_By", typeof(string)); if (_ObjBeatData.lst_SFCDetails != null && _ObjBeatData.lst_SFCDetails.Count > 0) { for (int i = 0; i < _ObjBeatData.lst_SFCDetails.Count; i++) { dtSFC.Rows.Add(companyCode, CompanyId, _ObjBeatData.lst_SFCDetails[i].Region_Code, _ObjBeatData.lst_SFCDetails[i].From_Region_Name, _ObjBeatData.lst_SFCDetails[i].To_Region_Name, _ObjBeatData.lst_SFCDetails[i].Distance_Fare_Code, _ObjBeatData.lst_SFCDetails[i].Route_Way, _ObjBeatData.lst_SFCDetails[i].Travel_Mode, _ObjBeatData.lst_SFCDetails[i].Created_By); } } DataTable dtWorkArea = new DataTable(); dtWorkArea.Columns.Add("Company_Code", typeof(string)); dtWorkArea.Columns.Add("Company_Id", typeof(string)); dtWorkArea.Columns.Add("Work_Area_Name", typeof(string)); dtWorkArea.Columns.Add("Region_Code", typeof(string)); dtWorkArea.Columns.Add("Created_By", typeof(string)); if (_ObjBeatData.lst_WorkArea != null && _ObjBeatData.lst_WorkArea.Count > 0) { for (int i = 0; i < _ObjBeatData.lst_WorkArea.Count; i++) { dtWorkArea.Rows.Add(companyCode, CompanyId, _ObjBeatData.lst_WorkArea[i].Work_Area, _ObjBeatData.lst_WorkArea[i].Region_Code, _ObjBeatData.lst_WorkArea[i].Created_By); } } if (_ObjBeatData.Mode.ToUpper() == "INSERT") { result = _objBeat.InsertBeatPlanDetails(companyCode, regionCode, _ObjBeatData, dtSFC, dtWorkArea, Weeknumber, Weekday); } else { result = _objBeat.UpdateBeatPlanDetails(companyCode, regionCode, _ObjBeatData, dtSFC, dtWorkArea, Weeknumber, Weekday); } } catch (Exception ex) { throw; } return(result); }
public JsonResult InsertBeatPlanDetails(string companyCode, string regionCode, string _ObjBeatData, int Weeknumber, string Weekday) { OutPutJsonBeatModel result = new OutPutJsonBeatModel(); BeatPlanModel _objDetailsBeat = new BeatPlanModel(); string companyId = ""; companyId = _objCurrentInfo.GetCompanyId(); int CompanyId = Convert.ToInt32(companyId); _objDetailsBeat = (BeatPlanModel)JsonConvert.DeserializeObject(_ObjBeatData, typeof(BeatPlanModel)); result = _ObjBeat.InsertBeatPlanDetails(companyCode, regionCode, CompanyId, _objDetailsBeat, Weeknumber, Weekday); return(Json(result, JsonRequestBehavior.AllowGet)); }
public JsonResult UpdateApproveorUnApproveBeat(string companyCode, string regionCode, string objBeatData) { try { OutPutJsonBeatModel result = new OutPutJsonBeatModel(); List <BeatPlanModel> _objDetailsBeat = new List <BeatPlanModel>(); string companyId = ""; companyId = _objCurrentInfo.GetCompanyId(); int CompanyId = Convert.ToInt32(companyId); _objDetailsBeat = (List <BeatPlanModel>)JsonConvert.DeserializeObject(objBeatData, typeof(List <BeatPlanModel>)); result = _ObjBeat.UpdateApproveorUnApproveBeat(companyCode, CompanyId, regionCode, _objDetailsBeat); return(Json(result, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { throw; } }
public OutPutJsonBeatModel UpdateApproveorUnApproveBeat(string companyCode, int companyId, string regionCode, List <BeatPlanModel> lstApprorUnAppr, DataTable dtApprorUnAppr) { _objSPData = new SPData(); _objData = new Data(); OutPutJsonBeatModel output = new OutPutJsonBeatModel(); string response = string.Empty; try { SqlCommand command = new SqlCommand(SP_HD_BPP_UPDATEAPPROVEORUNAPPROVEOFBEATS); command.CommandType = CommandType.StoredProcedure; _objSPData.AddParamToSqlCommand(command, "@CompanyCode", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode); _objSPData.AddParamToSqlCommand(command, "@RegionCode", ParameterDirection.Input, SqlDbType.VarChar, 30, regionCode); if (dtApprorUnAppr.Rows.Count > 0) { _objSPData.AddParamToSqlCommandWithTypeName(command, "@TVP_BPP_UpdateBeatApproveOrUnApprove", ParameterDirection.Input, SqlDbType.Structured, dtApprorUnAppr, "TVP_BPP_UpdateBeatApproveOrUnApprove"); } else { _objSPData.AddParamToSqlCommandWithTypeName(command, "@TVP_BPP_UpdateBeatApproveOrUnApprove", ParameterDirection.Input, SqlDbType.Structured, null, "TVP_BPP_UpdateBeatApproveOrUnApprove"); } _objSPData.AddParamToSqlCommand(command, "@Result", ParameterDirection.Output, SqlDbType.VarChar, 8000, ""); _objData.OpenConnection(); _objData.ExecuteNonQuery(command); response = Convert.ToString(command.Parameters["@Result"].Value); if (!(response.Contains("INFO"))) { output.Status_Message = true; output.Message = "Success:Successfully Approved/UnApproved selected Beat/Patch Plan(s)."; } else { output.Status_Message = false; output.Message = response; } } catch (Exception ex) { throw; } return(output); }
public OutPutJsonBeatModel InsertBeatToMasterDataTagging(string companyCode, DataTable dtTagged, List <MasterDataTaggedModel> lstTaggedData) { _objSPData = new SPData(); _objData = new Data(); OutPutJsonBeatModel output = new OutPutJsonBeatModel(); string response = string.Empty; try { SqlCommand command = new SqlCommand(SP_HD_BPP_INSERTMASTERDATATAGGING); command.CommandType = CommandType.StoredProcedure; _objSPData.AddParamToSqlCommand(command, "@CompanyCode", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode); if (dtTagged.Rows.Count > 0) { _objSPData.AddParamToSqlCommandWithTypeName(command, "@TVP_BPP_InsertTaggedMasterData", ParameterDirection.Input, SqlDbType.Structured, dtTagged, "TVP_BPP_InsertTaggedMasterData"); } else { _objSPData.AddParamToSqlCommandWithTypeName(command, "@TVP_BPP_InsertTaggedMasterData", ParameterDirection.Input, SqlDbType.Structured, null, "TVP_BPP_InsertTaggedMasterData"); } _objSPData.AddParamToSqlCommand(command, "@Result", ParameterDirection.Output, SqlDbType.VarChar, 8000, ""); _objData.OpenConnection(); _objData.ExecuteNonQuery(command); response = Convert.ToString(command.Parameters["@Result"].Value); if (!(response.Contains("INFO"))) { output.Status_Message = true; output.Message = "Success:Successfully Tagged to the selected Beat/Patch Plan(s)."; } else { output.Status_Message = false; output.Message = response; } } catch (Exception ex) { throw; } return(output); }
public OutPutJsonBeatModel UpdateBeatPlanDetails(string companyCode, string regionCode, BeatPlanModel _ObjBeatData, DataTable dtSFC, DataTable dtWorkArea, int Weeknumber, string Weekday) { bool result = false; _objSPData = new SPData(); _objData = new Data(); OutPutJsonBeatModel output = new OutPutJsonBeatModel(); long BeatCodeHistory = GetSeqNumber("SEQ_tbl_SFA_Camp_Planner_Header_History"); string response = string.Empty; try { SqlCommand command = new SqlCommand(SP_HD_BPP_UPDATEBEATPLANDETAILS); command.CommandType = CommandType.StoredProcedure; _objSPData.AddParamToSqlCommand(command, "@CompanyCode", ParameterDirection.Input, SqlDbType.VarChar, 30, companyCode); _objSPData.AddParamToSqlCommand(command, "@RegionCode", ParameterDirection.Input, SqlDbType.VarChar, 30, regionCode); _objSPData.AddParamToSqlCommand(command, "@BeatName", ParameterDirection.Input, SqlDbType.VarChar, 1000, _ObjBeatData.Beat_Name); _objSPData.AddParamToSqlCommand(command, "@BeatCode", ParameterDirection.Input, SqlDbType.VarChar, 100, _ObjBeatData.Beat_Code); _objSPData.AddParamToSqlCommand(command, "@HistoryBeatCode", ParameterDirection.Input, SqlDbType.VarChar, 100, BeatCodeHistory); _objSPData.AddParamToSqlCommand(command, "@WorKArea", ParameterDirection.Input, SqlDbType.VarChar, 8000, _ObjBeatData.Work_Area); _objSPData.AddParamToSqlCommand(command, "@Work_Category_Code", ParameterDirection.Input, SqlDbType.VarChar, 30, _ObjBeatData.Work_Category_Code); _objSPData.AddParamToSqlCommand(command, "@Work_Category_Name", ParameterDirection.Input, SqlDbType.VarChar, 1000, _ObjBeatData.Work_Category_Name); _objSPData.AddParamToSqlCommand(command, "@Created_By", ParameterDirection.Input, SqlDbType.VarChar, 100, _ObjBeatData.Created_By); _objSPData.AddParamToSqlCommand(command, "@WeekNumber", ParameterDirection.Input, SqlDbType.Int, 8, Weeknumber); _objSPData.AddParamToSqlCommand(command, "@WeekDay", ParameterDirection.Input, SqlDbType.VarChar, 30, Weekday); if (dtSFC.Rows.Count > 0) { _objSPData.AddParamToSqlCommandWithTypeName(command, "@TVP_BPP_InsertBeatSFCDetails", ParameterDirection.Input, SqlDbType.Structured, dtSFC, "TVP_BPP_InsertBeatSFCDetails"); } else { _objSPData.AddParamToSqlCommandWithTypeName(command, "@TVP_BPP_InsertBeatSFCDetails", ParameterDirection.Input, SqlDbType.Structured, null, "TVP_BPP_InsertBeatSFCDetails"); } if (dtSFC.Rows.Count > 0) { _objSPData.AddParamToSqlCommandWithTypeName(command, "@TVP_BPP_InsertBeatWADetails", ParameterDirection.Input, SqlDbType.Structured, dtWorkArea, "TVP_BPP_InsertBeatWADetails"); } else { _objSPData.AddParamToSqlCommandWithTypeName(command, "@TVP_BPP_InsertBeatWADetails", ParameterDirection.Input, SqlDbType.Structured, null, "TVP_BPP_InsertBeatWADetails"); } _objSPData.AddParamToSqlCommand(command, "@Result", ParameterDirection.Output, SqlDbType.VarChar, 8000, ""); _objData.OpenConnection(); _objData.ExecuteNonQuery(command); response = Convert.ToString(command.Parameters["@Result"].Value); if (!(response.Contains("INFO"))) { output.Status_Message = true; output.Message = "Success:Successfully Updated Beat/Patch Plan."; } else { output.Status_Message = false; output.Message = response; } } catch (Exception ex) { throw; } return(output); }