public static IList <UOMMasterModel> GetUOMMasterList(int?IntID, int selectionType, string SearchBy, string SearchString, Guid?CompanyId, int ItemsPerPage, int RequestPageNo, int CurrentPageNo) { ArrayList paramList = new ArrayList(); string resultString; IList <UOMMasterModel> objUOMMasterModel = null; UOMMasterModel obj = new UOMMasterModel(); obj.SearchString = SearchString; obj.RequestType = selectionType; obj.IntID = IntID; obj.CompanyId = CompanyId; obj.ItemsPerPage = ItemsPerPage; obj.RequestPageNo = RequestPageNo; paramList.Add(obj); using (var client = new HttpClient()) { Uri baseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["UriPath"]); client.BaseAddress = baseAddress; resultString = client.PostAsJsonAsync("api/UOMMaster/UOMMaster_List", paramList) .Result .Content.ReadAsStringAsync().Result; } objUOMMasterModel = (IList <UOMMasterModel>)Newtonsoft.Json.JsonConvert.DeserializeObject(resultString, typeof(IList <UOMMasterModel>)); return(objUOMMasterModel); }
public IList <UOMMasterModel> UOMMaster_List(ArrayList paramList) { UOMMasterModel apiObject = new UOMMasterModel(); string strResult = ""; IList <UOMMasterModel> apiObjectList = null; apiObject = Newtonsoft.Json.JsonConvert.DeserializeObject <UOMMasterModel>(paramList[0].ToString()); /// ============= apiObjectList = fnUOMMaster_List(apiObject, ref strResult); return(apiObjectList); }
public UOMMasterModel UOMMaster_InsertUpdate(ArrayList paramList) { string strResult = ""; string strReturnCode = "000"; string strReturnMsg = "UnDefined"; UOMMasterModel apiObject = new UOMMasterModel(); apiObject = Newtonsoft.Json.JsonConvert.DeserializeObject <UOMMasterModel>(paramList[0].ToString()); string crCnString = UtilityLib.GetConnectionString(); int FieldCodeInfo = DAL_UOMMaster.UOMMaster_InsertUpdate(crCnString, apiObject.UOMId, apiObject.UOMTypeId, apiObject.UOMName, apiObject.UOMCode, apiObject.DecimalPoints, apiObject.BaseUnit, apiObject.ConversionRation, 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); }
public static UOMMasterModel UOMMaster_InsertUpdate(UOMMasterModel objUOMMaster) { ArrayList paramList = new ArrayList(); string resultString; UOMMasterModel objUOMMasterModel = null; UOMMasterModel obj = new UOMMasterModel(); obj.UOMId = objUOMMaster.UOMId; obj.UOMTypeId = objUOMMaster.UOMTypeId; obj.ConversionRation = objUOMMaster.ConversionRation; obj.UOMName = objUOMMaster.UOMName; obj.UOMCode = objUOMMaster.UOMCode; obj.DecimalPoints = objUOMMaster.DecimalPoints; obj.BaseUnit = objUOMMaster.BaseUnit; obj.CompanyId = objUOMMaster.CompanyId; paramList.Add(obj); string apiCall = string.Empty; if (objUOMMaster.UOMId == 0) { apiCall = "api/UOMMaster/UOMMaster_InsertUpdate"; } else { apiCall = "api/UOMMaster/UOMMaster_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; } objUOMMasterModel = (UOMMasterModel)Newtonsoft.Json.JsonConvert.DeserializeObject(resultString, typeof(UOMMasterModel)); return(objUOMMasterModel); }
private IList <UOMMasterModel> fnUOMMaster_List(UOMMasterModel apiObject, ref string strResult) { string strReturnCode = "000"; string strReturnMsg = "UnDefined"; string crCnString = UtilityLib.GetConnectionString(); IList <UOMMasterModel> objUOMMasterModelList = new List <UOMMasterModel>(); DataSet usersInfoDS = DAL_UOMMaster.UOMMaster_List(crCnString, apiObject.RequestType, apiObject.SearchBy, apiObject.SearchString, apiObject.IntID, apiObject.CompanyId, apiObject.ItemsPerPage, apiObject.RequestPageNo, apiObject.CurrentPageNo); DataTable usersInfoDT = usersInfoDS.Tables[0]; if (usersInfoDT != null && usersInfoDT.Rows.Count > 0) { strReturnCode = "001"; strReturnMsg = "Success"; foreach (DataRow dr in usersInfoDT.Rows) { apiObject = new UOMMasterModel(); apiObject.UOMId = UtilityLib.FormatNumber(dr["UOMId"].ToString()); apiObject.UOMTypeId = UtilityLib.FormatNumber(dr["UOMTypeId"].ToString()); apiObject.DecimalPoints = UtilityLib.FormatNumber(dr["DecimalPoints"].ToString()); apiObject.BaseUnit = (bool)dr["BaseUnit"]; apiObject.ConversionRation = UtilityLib.FormatDecimal(dr["ConversionRation"].ToString()); apiObject.UOMName = (string)dr["UOMName"]; apiObject.UOMCode = (string)dr["UOMCode"]; apiObject.CompanyId = (Guid)(dr["CompanyId"]); objUOMMasterModelList.Add(apiObject); } } else { strReturnCode = "002"; apiObject.ReturnMessage = "Fail-Record Not Found"; } strResult = strReturnCode + "|" + strReturnMsg; return(objUOMMasterModelList); }