public static IList <GeneralMasterModel> GetGeneralMasterList(int?IntID, int selectionType, int GeneralMasterClassId, string SearchBy, string SearchString, Guid?CompanyId, int ItemsPerPage, int RequestPage, int CurrentPageNo) { ArrayList paramList = new ArrayList(); string resultString; IList <GeneralMasterModel> objGeneralMasterModel = null; GeneralMasterModel obj = new GeneralMasterModel(); obj.SearchString = SearchString; obj.RequestType = selectionType; obj.IntID = IntID; obj.CompanyId = CompanyId; obj.ItemsPerPage = ItemsPerPage; obj.RequestPageNo = RequestPage; obj.GeneralMasterClassId = GeneralMasterClassId; paramList.Add(obj); using (var client = new HttpClient()) { Uri baseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["UriPath"]); client.BaseAddress = baseAddress; resultString = client.PostAsJsonAsync("api/GeneralMaster/GeneralMaster_List", paramList) .Result .Content.ReadAsStringAsync().Result; } objGeneralMasterModel = (IList <GeneralMasterModel>)Newtonsoft.Json.JsonConvert.DeserializeObject(resultString, typeof(IList <GeneralMasterModel>)); return(objGeneralMasterModel); }
public IList <GeneralMasterModel> GeneralMaster_List(ArrayList paramList) { GeneralMasterModel apiObject = new GeneralMasterModel(); string strResult = ""; IList <GeneralMasterModel> apiObjectList = null; apiObject = Newtonsoft.Json.JsonConvert.DeserializeObject <GeneralMasterModel>(paramList[0].ToString()); /// ============= apiObjectList = fnGeneralMaster_List(apiObject, ref strResult); return(apiObjectList); }
public GeneralMasterModel GeneralMaster_InsertUpdate(ArrayList paramList) { string strResult = ""; string strReturnCode = "000"; string strReturnMsg = "UnDefined"; GeneralMasterModel apiObject = new GeneralMasterModel(); apiObject = Newtonsoft.Json.JsonConvert.DeserializeObject <GeneralMasterModel>(paramList[0].ToString()); string crCnString = UtilityLib.GetConnectionString(); int FieldCodeInfo = DAL_GeneralMaster.GeneralMaster_InsertUpdate(crCnString, apiObject.GeneralMasterId, apiObject.GeneralMasterClassId, apiObject.GeneralMasterName, apiObject.GeneralMasterCode, apiObject.GeneralMasterSquence, apiObject.CreatedBy, apiObject.ModifiedBy, apiObject.CompanyId); if (FieldCodeInfo == 0) { apiObject.ReturnCode = FieldCodeInfo; apiObject.ReturnMessage = "Success"; } else if (FieldCodeInfo == 1) { apiObject.ReturnCode = FieldCodeInfo; apiObject.ReturnMessage = "General Master already exists"; } else if (FieldCodeInfo == 101) { apiObject.ReturnCode = FieldCodeInfo; apiObject.ReturnMessage = "General Master updated successfully"; } else if (FieldCodeInfo == 2) { apiObject.ReturnCode = FieldCodeInfo; apiObject.ReturnMessage = "record is already updated by someone else"; } else { apiObject.ReturnCode = FieldCodeInfo; apiObject.ReturnMessage = "Fail-Record Not Inserted"; } strResult = strReturnCode + "|" + strReturnMsg; return(apiObject); }
private IList <GeneralMasterModel> fnGeneralMaster_List(GeneralMasterModel apiObject, ref string strResult) { string strReturnCode = "000"; string strReturnMsg = "UnDefined"; string crCnString = UtilityLib.GetConnectionString(); IList <GeneralMasterModel> objFieldCodeModelList = new List <GeneralMasterModel>(); DataSet usersInfoDS = DAL_GeneralMaster.GeneralMaster_List(crCnString, apiObject.RequestType, apiObject.SearchBy, apiObject.SearchString, apiObject.IntID, apiObject.GeneralMasterClassId, apiObject.CompanyId, apiObject.ItemsPerPage, apiObject.RequestPageNo, apiObject.CurrentPageNo); if (usersInfoDS.Tables.Count != 0) { DataTable usersInfoDT = usersInfoDS.Tables[0]; if (usersInfoDT != null && usersInfoDT.Rows.Count > 0) { strReturnCode = "001"; strReturnMsg = "Success"; foreach (DataRow dr in usersInfoDT.Rows) { apiObject = new GeneralMasterModel(); apiObject.GeneralMasterId = UtilityLib.FormatNumber(dr["GeneralMasterId"].ToString()); apiObject.GeneralMasterName = (string)dr["GeneralMasterName"]; apiObject.GeneralMasterClassId = UtilityLib.FormatNumber(dr["GeneralMasterClassId"].ToString()); apiObject.GeneralMasterClassName = (string)dr["GeneralMasterClassName"]; apiObject.GeneralMasterCode = (string)dr["GeneralMasterCode"]; apiObject.GeneralMasterSquence = (string)dr["GeneralMasterSequence"]; apiObject.CreatedBy = (Guid)dr["CreatedBy"]; apiObject.ModifiedBy = (Guid)dr["ModifiedBy"]; apiObject.CompanyId = (Guid)(dr["CompanyId"]); objFieldCodeModelList.Add(apiObject); } } else { strReturnCode = "002"; strReturnMsg = "Fail-Record Not Found"; } } strResult = strReturnCode + "|" + strReturnMsg; return(objFieldCodeModelList); }
public static GeneralMasterModel GeneralMaster_InsertUpdate(GeneralMasterModel objgeneralclass) { ArrayList paramList = new ArrayList(); string resultString; GeneralMasterModel objGeneralClassModel = null; GeneralMasterModel obj = new GeneralMasterModel(); obj.GeneralMasterId = objgeneralclass.GeneralMasterId; obj.GeneralMasterClassId = objgeneralclass.GeneralMasterClassId; obj.GeneralMasterName = objgeneralclass.GeneralMasterName; obj.GeneralMasterCode = objgeneralclass.GeneralMasterCode; obj.GeneralMasterSquence = objgeneralclass.GeneralMasterSquence; obj.CompanyId = objgeneralclass.CompanyId; paramList.Add(obj); string apiCall = string.Empty; if (objgeneralclass.GeneralMasterId == 0) { apiCall = "api/GeneralMaster/GeneralMaster_InsertUpdate"; } else { apiCall = "api/GeneralMaster/GeneralMaster_InsertUpdate"; } using (var client = new HttpClient()) { Uri baseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["UriPath"]); client.BaseAddress = baseAddress; resultString = client.PostAsJsonAsync(apiCall, paramList) .Result .Content.ReadAsStringAsync().Result; } objGeneralClassModel = (GeneralMasterModel)Newtonsoft.Json.JsonConvert.DeserializeObject(resultString, typeof(GeneralMasterModel)); return(objGeneralClassModel); }