private RepairProcessNumRange objCreateRepairProcessNumRange(DataRow dr)
        {
            RepairProcessNumRange tRepairProcessNumRange = new RepairProcessNumRange();

            tRepairProcessNumRange.SetObjectInfo(dr);

            return(tRepairProcessNumRange);
        }
        public RepairProcessNumRange objGetRepairProcessNumRange(string argRepairProcDocTypeCode, string argNumRangeCode, string argClientCode)
        {
            RepairProcessNumRange argRepairProcessNumRange = new RepairProcessNumRange();
            DataSet DataSetToFill = new DataSet();

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

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

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

            DataSetToFill = this.GetRepairProcessNumRange(argRepairProcDocTypeCode, argNumRangeCode, argClientCode);

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

            argRepairProcessNumRange = this.objCreateRepairProcessNumRange((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argRepairProcessNumRange);
        }
        public void UpdateRepairProcessNumRange(RepairProcessNumRange argRepairProcessNumRange, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[8];
            param[0] = new SqlParameter("@RepairProcDocTypeCode", argRepairProcessNumRange.RepairProcDocTypeCode);
            param[1] = new SqlParameter("@NumRangeCode", argRepairProcessNumRange.NumRangeCode);
            param[2] = new SqlParameter("@ClientCode", argRepairProcessNumRange.ClientCode);
            param[3] = new SqlParameter("@CreatedBy", argRepairProcessNumRange.CreatedBy);
            param[4] = new SqlParameter("@ModifiedBy", argRepairProcessNumRange.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_UpdateRepairProcessNumRange", 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);
        }
        public ICollection <RepairProcessNumRange> colGetRepairProcessNumRange(string argClientCode)
        {
            List <RepairProcessNumRange> lst             = new List <RepairProcessNumRange>();
            DataSet DataSetToFill                        = new DataSet();
            RepairProcessNumRange tRepairProcessNumRange = new RepairProcessNumRange();

            DataSetToFill = this.GetRepairProcessNumRange(argClientCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }
        public ICollection <ErrorHandler> SaveRepairProcessNumRange(RepairProcessNumRange argRepairProcessNumRange)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsRepairProcessNumRangeExists(argRepairProcessNumRange.RepairProcDocTypeCode, argRepairProcessNumRange.NumRangeCode, argRepairProcessNumRange.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertRepairProcessNumRange(argRepairProcessNumRange, 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();
                    UpdateRepairProcessNumRange(argRepairProcessNumRange, 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);
        }