private FiscalYearMaster objCreateFiscalYearMaster(DataRow dr)
        {
            FiscalYearMaster tFiscalYearMaster = new FiscalYearMaster();

            tFiscalYearMaster.SetObjectInfo(dr);

            return(tFiscalYearMaster);
        }
        public void UpdateFiscalYearMaster(FiscalYearMaster argFiscalYearMaster, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[12];
            param[0] = new SqlParameter("@FiscalYearType", argFiscalYearMaster.FiscalYearType);
            param[1] = new SqlParameter("@FiscalYear", argFiscalYearMaster.FiscalYear);
            param[2] = new SqlParameter("@FYStartDate", argFiscalYearMaster.FYStartDate);
            param[3] = new SqlParameter("@FYEndDate", argFiscalYearMaster.FYEndDate);
            param[4] = new SqlParameter("@CompanyCode", argFiscalYearMaster.CompanyCode);
            param[5] = new SqlParameter("@IsOpen", argFiscalYearMaster.IsOpen);
            param[6] = new SqlParameter("@ClientCode", argFiscalYearMaster.ClientCode);
            param[7] = new SqlParameter("@CreatedBy", argFiscalYearMaster.CreatedBy);
            param[8] = new SqlParameter("@ModifiedBy", argFiscalYearMaster.ModifiedBy);


            param[9]           = new SqlParameter("@Type", SqlDbType.Char);
            param[9].Size      = 1;
            param[9].Direction = ParameterDirection.Output;

            param[10]           = new SqlParameter("@Message", SqlDbType.VarChar);
            param[10].Size      = 255;
            param[10].Direction = ParameterDirection.Output;

            param[11]           = new SqlParameter("@returnvalue", SqlDbType.VarChar);
            param[11].Size      = 20;
            param[11].Direction = ParameterDirection.Output;

            int i = da.NExecuteNonQuery("Proc_UpdateFiscalYearMaster", param);


            string strMessage  = Convert.ToString(param[10].Value);
            string strType     = Convert.ToString(param[9].Value);
            string strRetValue = Convert.ToString(param[11].Value);


            objErrorHandler.Type        = strType;
            objErrorHandler.MsgId       = 0;
            objErrorHandler.Module      = ErrorConstant.strInsertModule;
            objErrorHandler.ModulePart  = ErrorConstant.strMasterModule;
            objErrorHandler.Message     = strMessage.ToString();
            objErrorHandler.RowNo       = 0;
            objErrorHandler.FieldName   = "";
            objErrorHandler.LogCode     = "";
            objErrorHandler.ReturnValue = strRetValue;
            lstErr.Add(objErrorHandler);
        }
        public FiscalYearMaster objGetFiscalYearMaster(string argFiscalYearType, string argFiscalYear, string argClientCode)
        {
            FiscalYearMaster argFiscalYearMaster = new FiscalYearMaster();
            DataSet          DataSetToFill       = new DataSet();

            if (argFiscalYearType.Trim() == "")
            {
                goto ErrorHandlers;
            }

            if (argFiscalYear.Trim() == "")
            {
                goto ErrorHandlers;
            }

            if (argClientCode.Trim() == "")
            {
                goto ErrorHandlers;
            }

            DataSetToFill = this.GetFiscalYearMaster(argFiscalYearType, argFiscalYear, argClientCode);

            if (DataSetToFill.Tables[0].Rows.Count <= 0)
            {
                goto Finish;
            }

            argFiscalYearMaster = this.objCreateFiscalYearMaster((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argFiscalYearMaster);
        }
        public ICollection <FiscalYearMaster> colGetFiscalYearMaster(string argFiscalYearType, string argClientCode)
        {
            List <FiscalYearMaster> lst        = new List <FiscalYearMaster>();
            DataSet          DataSetToFill     = new DataSet();
            FiscalYearMaster tFiscalYearMaster = new FiscalYearMaster();

            DataSetToFill = this.GetFiscalYearMaster(argFiscalYearType, argClientCode);

            if (DataSetToFill != null)
            {
                foreach (DataRow dr in DataSetToFill.Tables[0].Rows)
                {
                    lst.Add(objCreateFiscalYearMaster(dr));
                }
            }
            goto Finish;

Finish:
            DataSetToFill = null;


            return(lst);
        }
        public ICollection <ErrorHandler> SaveFiscalYearMaster(FiscalYearMaster argFiscalYearMaster)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsFiscalYearMasterExists(argFiscalYearMaster.FiscalYearType, argFiscalYearMaster.FiscalYear, argFiscalYearMaster.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertFiscalYearMaster(argFiscalYearMaster, da, lstErr);
                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                    da.COMMIT_TRANSACTION();
                }
                else
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    UpdateFiscalYearMaster(argFiscalYearMaster, da, lstErr);
                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                    da.COMMIT_TRANSACTION();
                }
            }
            catch (Exception ex)
            {
                if (da != null)
                {
                    da.ROLLBACK_TRANSACTION();
                }
                objErrorHandler.Type       = ErrorConstant.strAboartType;
                objErrorHandler.MsgId      = 0;
                objErrorHandler.Module     = ErrorConstant.strInsertModule;
                objErrorHandler.ModulePart = ErrorConstant.strMasterModule;
                objErrorHandler.Message    = ex.Message.ToString();
                objErrorHandler.RowNo      = 0;
                objErrorHandler.FieldName  = "";
                objErrorHandler.LogCode    = "";
                lstErr.Add(objErrorHandler);
            }
            finally
            {
                if (da != null)
                {
                    da.Close_Connection();
                    da = null;
                }
            }
            return(lstErr);
        }