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); }