private DocumentTypeMapping objCreateDocumentTypeMapping(DataRow dr)
        {
            DocumentTypeMapping tDocumentTypeMapping = new DocumentTypeMapping();

            tDocumentTypeMapping.SetObjectInfo(dr);
            return(tDocumentTypeMapping);
        }
        public DocumentTypeMapping objGetDocumentTypeMapping(string argFromDocType, string argFrmDocTypeCode, string argToDocType, string argToDocTypeCode, string argClientCode)
        {
            DocumentTypeMapping argDocumentTypeMapping = new DocumentTypeMapping();
            DataSet             DataSetToFill          = new DataSet();

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

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

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

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

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

            DataSetToFill = this.GetDocumentTypeMapping(argFromDocType, argFrmDocTypeCode, argToDocType, argToDocTypeCode, argClientCode);

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

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argDocumentTypeMapping);
        }
        public void UpdateDocumentTypeMapping(DocumentTypeMapping argDocumentTypeMapping, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[12];
            param[0] = new SqlParameter("@FromDocType", argDocumentTypeMapping.FromDocType);
            param[1] = new SqlParameter("@FrmDocTypeCode", argDocumentTypeMapping.FrmDocTypeCode);
            param[2] = new SqlParameter("@FrmDocTypeDesc", argDocumentTypeMapping.FrmDocTypeDesc);
            param[3] = new SqlParameter("@ToDocType", argDocumentTypeMapping.ToDocType);
            param[4] = new SqlParameter("@ToDocTypeCode", argDocumentTypeMapping.ToDocTypeCode);
            param[5] = new SqlParameter("@ToDocTypeDesc", argDocumentTypeMapping.ToDocTypeDesc);
            param[6] = new SqlParameter("@ClientCode", argDocumentTypeMapping.ClientCode);
            param[7] = new SqlParameter("@CreatedBy", argDocumentTypeMapping.CreatedBy);
            param[8] = new SqlParameter("@ModifiedBy", argDocumentTypeMapping.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_UpdateDocumentTypeMapping", 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    = "";
            lstErr.Add(objErrorHandler);
        }
        public ICollection <DocumentTypeMapping> colGetDocumentTypeMapping(DataTable dt, string argUserName, string clientCode)
        {
            List <DocumentTypeMapping> lst = new List <DocumentTypeMapping>();
            DocumentTypeMapping        objDocumentTypeMapping = null;

            foreach (DataRow dr in dt.Rows)
            {
                objDocumentTypeMapping                = new DocumentTypeMapping();
                objDocumentTypeMapping.FromDocType    = Convert.ToString(dr["FromDocType"]).Trim();
                objDocumentTypeMapping.FrmDocTypeCode = Convert.ToString(dr["FrmDocTypeCode"]).Trim();
                objDocumentTypeMapping.FrmDocTypeDesc = Convert.ToString(dr["FrmDocTypeDesc"]).Trim();
                objDocumentTypeMapping.ToDocType      = Convert.ToString(dr["ToDocType"]).Trim();
                objDocumentTypeMapping.ToDocTypeCode  = Convert.ToString(dr["ToDocTypeCode"]).Trim();
                objDocumentTypeMapping.ToDocTypeDesc  = Convert.ToString(dr["ToDocTypeDesc"]).Trim();
                objDocumentTypeMapping.IsDeleted      = Convert.ToInt32(dr["IsDeleted"]);
                objDocumentTypeMapping.ModifiedBy     = Convert.ToString(argUserName).Trim();
                objDocumentTypeMapping.CreatedBy      = Convert.ToString(argUserName).Trim();
                objDocumentTypeMapping.ClientCode     = Convert.ToString(clientCode).Trim();
                lst.Add(objDocumentTypeMapping);
            }
            return(lst);
        }
        public ICollection <DocumentTypeMapping> colGetDocumentTypeMapping(string argClientCode)
        {
            List <DocumentTypeMapping> lst           = new List <DocumentTypeMapping>();
            DataSet             DataSetToFill        = new DataSet();
            DocumentTypeMapping tDocumentTypeMapping = new DocumentTypeMapping();

            DataSetToFill = this.GetDocumentTypeMapping(argClientCode);

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

Finish:
            DataSetToFill = null;

            return(lst);
        }
        public ICollection <ErrorHandler> SaveDocumentTypeMapping(DocumentTypeMapping argDocumentTypeMapping)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsDocumentTypeMappingExists(argDocumentTypeMapping.FromDocType, argDocumentTypeMapping.FrmDocTypeCode, argDocumentTypeMapping.ToDocType, argDocumentTypeMapping.ToDocTypeCode, argDocumentTypeMapping.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertDocumentTypeMapping(argDocumentTypeMapping, 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();
                    UpdateDocumentTypeMapping(argDocumentTypeMapping, 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);
        }