public HttpResponseMessage AddCommissionSetup(HttpRequestMessage reqObject) { int result = 0; _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _CommissionSetup = JsonConvert.DeserializeObject <CommissionSetup>(_requestedDataObject.BusinessData); bool IsValid = ModelValidation.TryValidateModel(_CommissionSetup, out _modelErrorMsg); if (IsValid) { result = _ICommissionInfoService.AddCommissionSetup(_CommissionSetup); } } if (!string.IsNullOrWhiteSpace(_modelErrorMsg)) { _serviceResponse = _IDataManipulation.SetResponseObject(result, _modelErrorMsg); } else if (result == 1) { _serviceResponse = _IDataManipulation.SetResponseObject(result, "information has been added successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(result, "information hasn't been added"); } _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); }
public HttpResponseMessage UpdateCommissionSetup(HttpRequestMessage reqObject) { int result = 0; _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject); if (_requestedDataObject != null && _requestedDataObject.BusinessData != null) { _CommissionSetup = JsonConvert.DeserializeObject <CommissionSetup>(_requestedDataObject.BusinessData); } if (_CommissionSetup == null || string.IsNullOrWhiteSpace(_CommissionSetup.CommissionId)) { _serviceResponse = _IDataManipulation.SetResponseObject(result, "Account Type Not Found..."); _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); } result = _ICommissionInfoService.UpdateCommissionSetup(_CommissionSetup); if (result == 1) { _serviceResponse = _IDataManipulation.SetResponseObject(result, "information has been updated successfully"); } else { _serviceResponse = _IDataManipulation.SetResponseObject(result, "Commision Setup Not Found..."); } _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject); return(_response); }
public int AddCommissionSetup(CommissionSetup _CommissionSetup) { try { var _max = _IUoW.Repository <CommissionSetup>().GetMaxValue(x => x.CommissionId) + 1; _CommissionSetup.CommissionId = _max.ToString().PadLeft(8, '0'); _CommissionSetup.AuthStatusId = "A"; _CommissionSetup.LastAction = "ADD"; _CommissionSetup.MakeDT = System.DateTime.Now; _CommissionSetup.MakeBy = "mtaka"; var result = _IUoW.Repository <CommissionSetup>().Add(_CommissionSetup); List <CommissionSetupDTL> objListCommissionSetupDTL = new List <CommissionSetupDTL>(); var _maxCus = _IUoW.Repository <CommissionSetupDTL>().GetMaxValue(x => x.CommissionDtlId) + 1; for (int i = 0; i < _CommissionSetup.ListCommissionSetupDTL.Length; i++) { CommissionSetupDTL _objCommissionSetupDTL = new CommissionSetupDTL(); _objCommissionSetupDTL.CommissionDtlId = _maxCus.ToString().PadLeft(8, '0'); _objCommissionSetupDTL.CommissionId = _CommissionSetup.CommissionId; _objCommissionSetupDTL.AccTypeId = _CommissionSetup.ListCommissionSetupDTL[i].AccTypeId; _objCommissionSetupDTL.CommissionRate = _CommissionSetup.ListCommissionSetupDTL[i].CommissionRate; _objCommissionSetupDTL.AIT = _CommissionSetup.ListCommissionSetupDTL[i].AIT; _objCommissionSetupDTL.AuthStatusId = "U"; _objCommissionSetupDTL.LastAction = "ADD"; _objCommissionSetupDTL.MakeBy = "mTaka"; _objCommissionSetupDTL.MakeDT = System.DateTime.Now; objListCommissionSetupDTL.Add(_objCommissionSetupDTL); _maxCus += 1; } result = _IUoW.Repository <CommissionSetupDTL>().AddRange(objListCommissionSetupDTL); #region Auth Log if (result == 1) { _IAuthLogService = new AuthLogService(); long _outMaxSlAuthLogDtl = 0; result = _IAuthLogService.AddAuthLog(_IUoW, null, _CommissionSetup, "ADD", "0001", _CommissionSetup.FunctionId, 1, "CommissionSetupDTL", "MTK_COMMISSION_SETUP_DTL", "CommisionId", _CommissionSetup.CommissionId, "mtaka", _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl); } #endregion if (result == 1) { _IUoW.Commit(); } return(result); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "AddCommissionSetup(obj)", string.Empty); return(0); } }
public int UpdateCommissionSetup(CommissionSetup _CommissionSetup) { try { int result = 0; bool IsRecordExist; if (!string.IsNullOrWhiteSpace(_CommissionSetup.CommissionId)) { IsRecordExist = _IUoW.Repository <CommissionSetup>().IsRecordExist(x => x.CommissionId == _CommissionSetup.CommissionId); if (IsRecordExist) { var _oldCommissionSetup = _IUoW.Repository <CommissionSetup>().GetBy(x => x.CommissionId == _CommissionSetup.CommissionId); var _oldCommissionSetupForLog = ObjectCopier.DeepCopy(_oldCommissionSetup); _oldCommissionSetup.AuthStatusId = _CommissionSetup.AuthStatusId = "U"; _oldCommissionSetup.LastAction = _CommissionSetup.LastAction = "EDT"; _oldCommissionSetup.LastUpdateDT = _CommissionSetup.LastUpdateDT = System.DateTime.Now; _CommissionSetup.MakeBy = "mtaka"; result = _IUoW.Repository <CommissionSetup>().Update(_oldCommissionSetup); #region Testing Purpose #endregion #region Auth Log if (result == 1) { _IAuthLogService = new AuthLogService(); long _outMaxSlAuthLogDtl = 0; result = _IAuthLogService.AddAuthLog(_IUoW, _oldCommissionSetupForLog, _CommissionSetup, "EDT", "0001", "090101008", 1, "CommissionSetup", "MTK_COMMISSION_SETUP", "CommisionId", _CommissionSetup.CommissionId, "mtaka", _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl); } #endregion if (result == 1) { _IUoW.Commit(); } return(result); } } return(result); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "UpdateCommissionSetup(obj)", string.Empty); return(0); } }
public CommissionSetup GetCommissionSetupBy(CommissionSetup _CommissionSetup) { try { if (_CommissionSetup == null) { return(_CommissionSetup); } return(_IUoW.Repository <CommissionSetup>().GetBy(x => x.CommissionId == _CommissionSetup.CommissionId && x.AuthStatusId == "A" && x.LastAction != "DEL")); } catch (Exception ex) { _ObjErrorLogService = new ErrorLogService(); _ObjErrorLogService.AddErrorLog(ex, string.Empty, "GetCommissionSetupBy(obj)", string.Empty); return(null); } }
public CommissionSetup GetCommissionSetupById(Int64 Id) { Hashtable lstItems = new Hashtable(); lstItems.Add("@Id", Id); DataTable dt = dal.GetAllCommissionSetupById(lstItems); CommissionSetup objCommissionSetup = new CommissionSetup(); DataRow dr = dt.Rows[0]; return GetObject(dr); }
private static CommissionSetup GetObject(DataRow dr) { CommissionSetup objCommissionSetup = new CommissionSetup { Id = (Int64)dr["Id"], ServicdeId = (Int64)dr["ServicdeId"], DoctorsId = (Int64)dr["DoctorsId"], CommissionType = (String)dr["CommissionType"], CommissionPcnt = (Decimal)dr["CommissionPcnt"], CommissionAmount = (Decimal)dr["CommissionAmount"], ActivateDate = (String)dr["ActivateDate"], }; return objCommissionSetup; }