public AuthOrgRoleMaster objGetAuthOrgRoleMaster(string argAuthOrgcode, string argClientCode)
        {
            AuthOrgRoleMaster argAuthOrgRoleMaster = new AuthOrgRoleMaster();
            DataSet           DataSetToFill        = new DataSet();

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

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

            DataSetToFill = this.GetAuthOrgRoleMaster(argAuthOrgcode, argClientCode);

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

            argAuthOrgRoleMaster = this.objCreateAuthOrgRoleMaster((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argAuthOrgRoleMaster);
        }
        private AuthOrgRoleMaster objCreateAuthOrgRoleMaster(DataRow dr)
        {
            AuthOrgRoleMaster tAuthOrgRoleMaster = new AuthOrgRoleMaster();

            tAuthOrgRoleMaster.SetObjectInfo(dr);

            return(tAuthOrgRoleMaster);
        }
        public string UpdateAuthOrgRoleMaster(AuthOrgRoleMaster argAuthOrgRoleMaster, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[8];
            param[0] = new SqlParameter("@AuthOrgcode", argAuthOrgRoleMaster.AuthOrgcode);
            param[1] = new SqlParameter("@AuthORGDesc", argAuthOrgRoleMaster.AuthORGDesc);
            param[2] = new SqlParameter("@ClientCode", argAuthOrgRoleMaster.ClientCode);
            param[3] = new SqlParameter("@CreatedBy", argAuthOrgRoleMaster.CreatedBy);
            param[4] = new SqlParameter("@ModifiedBy", argAuthOrgRoleMaster.ModifiedBy);

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

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

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

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


            string strMessage  = Convert.ToString(param[6].Value);
            string strType     = Convert.ToString(param[5].Value);
            string strRetValue = Convert.ToString(param[7].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);

            return(strRetValue);
        }
        public ICollection <AuthOrgRoleMaster> colGetAuthOrgRoleMaster(string argClientCode)
        {
            List <AuthOrgRoleMaster> lst         = new List <AuthOrgRoleMaster>();
            DataSet           DataSetToFill      = new DataSet();
            AuthOrgRoleMaster tAuthOrgRoleMaster = new AuthOrgRoleMaster();

            DataSetToFill = this.GetAuthOrgRoleMaster(argClientCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }
        public ICollection <ErrorHandler> SaveAuthOrgRoleMaster(AuthOrgRoleMaster argAuthOrgRoleMaster, DataTable dtAuthORGRoleDetails)
        {
            List <ErrorHandler> lstErr              = new List <ErrorHandler>();
            DataAccess          da                  = new DataAccess();
            string             strRetValue          = "";
            AuthORGRoleDetails objAuthORGRoleDetail = null;

            try
            {
                da.Open_Connection();
                da.BEGIN_TRANSACTION();

                if (blnIsAuthOrgRoleMasterExists(argAuthOrgRoleMaster.AuthOrgcode, argAuthOrgRoleMaster.ClientCode, da) == false)
                {
                    strRetValue = InsertAuthOrgRoleMaster(argAuthOrgRoleMaster, da, lstErr);
                }
                else
                {
                    strRetValue = UpdateAuthOrgRoleMaster(argAuthOrgRoleMaster, da, lstErr);
                }

                foreach (ErrorHandler objerr in lstErr)
                {
                    if (objerr.Type == "E")
                    {
                        da.ROLLBACK_TRANSACTION();
                        return(lstErr);
                    }
                }

                if (dtAuthORGRoleDetails.Rows.Count > 0)
                {
                    foreach (DataRow dr in dtAuthORGRoleDetails.Rows)
                    {
                        objAuthORGRoleDetail                = new AuthORGRoleDetails();
                        objAuthORGRoleDetail.AuthOrgcode    = strRetValue;
                        objAuthORGRoleDetail.SerialNo       = Convert.ToInt32(dr["SerialNo"]);
                        objAuthORGRoleDetail.FieldName      = Convert.ToString(dr["FieldName"]);
                        objAuthORGRoleDetail.FieldValueFrom = Convert.ToString(dr["FieldValueFrom"]);
                        objAuthORGRoleDetail.FieldValueTo   = Convert.ToString(dr["FieldValueTo"]);
                        objAuthORGRoleDetail.IsDeleted      = Convert.ToInt32(dr["IsDeleted"]);
                        objAuthORGRoleDetail.ClientCode     = Convert.ToString(dr["ClientCode"]);
                        objAuthORGRoleDetail.CreatedBy      = Convert.ToString(dr["CreatedBy"]);
                        objAuthORGRoleDetail.ModifiedBy     = Convert.ToString(dr["ModifiedBy"]);

                        if (objAuthORGRoleDetail.IsDeleted == 0)
                        {
                            ObjAuthOrgroleDetailManager.SaveAuthORGRoleDetails(objAuthORGRoleDetail, da, lstErr);
                        }
                        else
                        {
                            ObjAuthOrgroleDetailManager.DeleteAuthORGRoleDetails(objAuthORGRoleDetail.AuthOrgcode, objAuthORGRoleDetail.FieldName, objAuthORGRoleDetail.ClientCode);
                        }
                    }

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