Exemplo n.º 1
0
        public HttpResponseMessage GetGLChartById(HttpRequestMessage reqObject)
        {
            string GLAccountSl = string.Empty;

            _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
            if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
            {
                _GLChart    = JsonConvert.DeserializeObject <GLChart>(_requestedDataObject.BusinessData);
                GLAccountSl = _GLChart.GLAccSl;
            }

            if (!string.IsNullOrWhiteSpace(GLAccountSl))
            {
                _GLChart = new GLChart();
                _GLChart = _IGLChartService.GetGLChartByAccSl(GLAccountSl);
            }
            if (_GLChart != null)
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(_GLChart, "information has been fetched successfully");
            }
            else
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(_GLChart, "GL Information Not Found...");
            }
            _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
            return(_response);
        }
Exemplo n.º 2
0
        public HttpResponseMessage CheckGLAccNo(HttpRequestMessage reqObject)
        {
            string glAccountNo = string.Empty;

            _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
            if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
            {
                glAccountNo = _requestedDataObject.BusinessData;
            }

            if (!string.IsNullOrWhiteSpace(glAccountNo) && glAccountNo.Length == 11)
            {
                _GLChart = new GLChart();
                _GLChart = _IGLChartService.GetGLChartByAccNo(glAccountNo);
            }
            else
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(0, "Please select GL Type then type GL Account Number..");
            }

            if (_GLChart != null)
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(0, "GL Account alrady exist.");
            }
            else
            {
                _serviceResponse = _serviceResponse == null?_IDataManipulation.SetResponseObject(1, "GL Account Not Found...") : _serviceResponse;
            }
            _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
            return(_response);
        }
Exemplo n.º 3
0
        public HttpResponseMessage DeleteGLChart(HttpRequestMessage reqObject)
        {
            int result = 0;

            _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
            if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
            {
                _GLChart = JsonConvert.DeserializeObject <GLChart>(_requestedDataObject.BusinessData);
            }

            if (_GLChart == null || string.IsNullOrWhiteSpace(_GLChart.GLAccSl))
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(result, "Union Information Id Not Found...");
                _response        = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
                return(_response);
            }

            result = _IGLChartService.DeleteGLChart(_GLChart);
            if (result == 1)
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(result, "information has been deleted successfully");
            }
            else
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(result, "information hasn't been deleted");
            }
            _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
            return(_response);
        }
Exemplo n.º 4
0
        public HttpResponseMessage UpdateGLChart(HttpRequestMessage reqObject)
        {
            int result = 0;

            _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
            if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
            {
                _GLChart = JsonConvert.DeserializeObject <GLChart>(_requestedDataObject.BusinessData);
                bool IsValid = ModelValidation.TryValidateModel(_GLChart, out _modelErrorMsg);
                if (IsValid)
                {
                    result = _IGLChartService.UpdateGLChart(_GLChart);
                }
            }

            if (!string.IsNullOrWhiteSpace(_modelErrorMsg))
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(result, _modelErrorMsg);
            }
            else if (result == 1)
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(result, "information has been updated successfully");
            }
            else
            {
                _serviceResponse = _IDataManipulation.SetResponseObject(result, "information hasn't been updated");
            }
            _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
            return(_response);
        }
Exemplo n.º 5
0
        public int UpdateGLChart(GLChart _GLChart)
        {
            try
            {
                int  result = 0;
                bool IsRecordExist;
                if (!string.IsNullOrWhiteSpace(_GLChart.GLAccSl))
                {
                    IsRecordExist = _IUoW.Repository <GLChart>().IsRecordExist(x => x.GLAccSl == _GLChart.GLAccSl);
                    if (IsRecordExist)
                    {
                        var _oldAccStatusSetup       = _IUoW.Repository <GLChart>().GetBy(x => x.GLAccSl == _GLChart.GLAccSl);
                        var _oldAccStatusSetupForLog = ObjectCopier.DeepCopy(_oldAccStatusSetup);

                        _oldAccStatusSetup.AuthStatusId = _GLChart.AuthStatusId = "U";
                        _oldAccStatusSetup.LastAction   = _GLChart.LastAction = "EDT";
                        _oldAccStatusSetup.LastUpdateDT = _GLChart.LastUpdateDT = System.DateTime.Now;
                        _GLChart.MakeBy = "mtaka";
                        result          = _IUoW.Repository <GLChart>().Update(_oldAccStatusSetup);

                        #region Testing Purpose
                        #endregion

                        #region Auth Log
                        if (result == 1)
                        {
                            _IAuthLogService = new AuthLogService();
                            long _outMaxSlAuthLogDtl = 0;
                            result = _IAuthLogService.AddAuthLog(_IUoW, _oldAccStatusSetupForLog, _GLChart, "EDT", "0001", "090102007", 1, "GLChart", "MTK_GL_CHART", "GLAccSl", _GLChart.GLAccSl, "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, "UpdateAccStatusSetup(obj)", string.Empty);
                return(0);
            }
        }
Exemplo n.º 6
0
 public GLChart GetGLChartBy(GLChart _GLChart)
 {
     try
     {
         if (_GLChart == null)
         {
             return(_GLChart);
         }
         return(_IUoW.Repository <GLChart>().GetBy(x => x.GLAccSl == _GLChart.GLAccSl &&
                                                   x.AuthStatusId == "A" &&
                                                   x.LastAction != "DEL"));
     }
     catch (Exception ex)
     {
         _ObjErrorLogService = new ErrorLogService();
         _ObjErrorLogService.AddErrorLog(ex, string.Empty, "GetGLChartBy(obj)", string.Empty);
         return(null);
     }
 }
Exemplo n.º 7
0
 public HttpResponseMessage GetGLChartBy(HttpRequestMessage reqObject)
 {
     _requestedDataObject = _IDataManipulation.GetRequestedDataObject(reqObject);
     if (_requestedDataObject != null && _requestedDataObject.BusinessData != null)
     {
         _GLChart = JsonConvert.DeserializeObject <GLChart>(_requestedDataObject.BusinessData);
         _GLChart = _IGLChartService.GetGLChartBy(_GLChart);
     }
     if (_GLChart != null)
     {
         _serviceResponse = _IDataManipulation.SetResponseObject(_GLChart, "information has been fetched successfully");
     }
     else
     {
         _serviceResponse = _IDataManipulation.SetResponseObject(_GLChart, "GL Information Not Found...");
     }
     _response = _IDataManipulation.CreateResponse(_serviceResponse, reqObject);
     return(_response);
 }
Exemplo n.º 8
0
        public int AddGLChart(GLChart _GLChart)
        {
            try
            {
                int result = 0;
                _GLChart.GLAccSl      = _IUoW.mTakaDbQuery().MaxGLAccSL(_GLChart.GLPrefix).ToString();
                _GLChart.GLAccNo      = _GLChart.GLPrefix + _GLChart.GLAccNo;
                _GLChart.OpeningDate  = Convert.ToDateTime(_GLChart.OpeningDate.ToShortDateString()).Date.AddDays(1);
                _GLChart.GLType       = _GLChart.GLType.Substring(0, 1);
                _GLChart.AuthStatusId = "U";
                _GLChart.LastAction   = "ADD";
                _GLChart.MakeDT       = System.DateTime.Now;
                _GLChart.MakeBy       = "mtaka";
                result = _IUoW.Repository <GLChart>().Add(_GLChart);

                if (result != 1)
                {
                    return(result);
                }

                var               _GLMaster     = AutoMapperCFG.SetObjectMapping <GLChart, GLMaster>(_GLChart);
                List <GLMaster>   _ListGLMaster = new List <GLMaster>();
                List <BranchInfo> _ListBranch   = _IUoW.Repository <BranchInfo>().Get(x => x.AuthStatusId == "A" && x.LastAction != "DEL").OrderBy(x => x.BranchId).ToList();
                var               _maxSl        = _IUoW.Repository <GLMaster>().GetMaxValue(x => x.Sl) + 1;

                for (int i = 0; i < _ListBranch.Count(); i++)
                {
                    _GLMaster.Sl       = (_maxSl++).ToString();
                    _GLMaster.BranchId = _ListBranch[i].BranchId;
                    GLMaster _GLMasterTemp = ObjectCopier.DeepCopy(_GLMaster);

                    _ListGLMaster.Add(_GLMasterTemp);
                }
                result = _IUoW.Repository <GLMaster>().AddRange(_ListGLMaster);



                #region Auth Log
                if (result == 1)
                {
                    _IAuthLogService = new AuthLogService();
                    long _outMaxSlAuthLogDtl = 0;
                    result = _IAuthLogService.AddAuthLog(_IUoW, null, _GLChart, "ADD", "0001", "090102017", 1, "GLChart", "MTK_GL_CHART", "GLAccSl", _GLChart.GLAccSl, "mtaka", _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl);
                    if (result == 1)
                    {
                        result = _IAuthLogService.AddAuthLog(_IUoW, null, _ListGLMaster, "ADD", "0001", "090102017", 0, "GLMaster", "MTK_GL_MASTER", "Sl", null, "mtaka", _outMaxSlAuthLogDtl, out _outMaxSlAuthLogDtl);
                    }
                }
                #endregion

                if (result == 1)
                {
                    _IUoW.Commit();
                }
                return(result);
            }
            catch (Exception ex)
            {
                _ObjErrorLogService = new ErrorLogService();
                _ObjErrorLogService.AddErrorLog(ex, string.Empty, "AddGLChart(obj)", string.Empty);
                return(0);
            }
        }