private PartnerPricingProcedure objCreatePartnerPricingProcedure(DataRow dr)
        {
            PartnerPricingProcedure tPartnerPricingProcedure = new PartnerPricingProcedure();

            tPartnerPricingProcedure.SetObjectInfo(dr);

            return(tPartnerPricingProcedure);
        }
        public void UpdatePartnerPricingProcedure(PartnerPricingProcedure argPartnerPricingProcedure, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[13];
            param[0] = new SqlParameter("@ProcedureType", argPartnerPricingProcedure.ProcedureType);
            param[1] = new SqlParameter("@LineItemNo", argPartnerPricingProcedure.LineItemNo);
            param[2] = new SqlParameter("@PricingDescription", argPartnerPricingProcedure.PricingDescription);
            param[3] = new SqlParameter("@CalculationType", argPartnerPricingProcedure.CalculationType);
            param[4] = new SqlParameter("@CalculationValue", argPartnerPricingProcedure.CalculationValue);
            param[5] = new SqlParameter("@CalculationOn", argPartnerPricingProcedure.CalculationOn);
            param[6] = new SqlParameter("@CalcLineItemNo", argPartnerPricingProcedure.CalcLineItemNo);
            param[7] = new SqlParameter("@ClientCode", argPartnerPricingProcedure.ClientCode);
            param[8] = new SqlParameter("@CreatedBy", argPartnerPricingProcedure.CreatedBy);
            param[9] = new SqlParameter("@ModifiedBy", argPartnerPricingProcedure.ModifiedBy);

            param[10]           = new SqlParameter("@Type", SqlDbType.Char);
            param[10].Size      = 1;
            param[10].Direction = ParameterDirection.Output;
            param[11]           = new SqlParameter("@Message", SqlDbType.VarChar);
            param[11].Size      = 255;
            param[11].Direction = ParameterDirection.Output;
            param[12]           = new SqlParameter("@returnvalue", SqlDbType.VarChar);
            param[12].Size      = 20;
            param[12].Direction = ParameterDirection.Output;

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


            string strMessage  = Convert.ToString(param[11].Value);
            string strType     = Convert.ToString(param[10].Value);
            string strRetValue = Convert.ToString(param[12].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 PartnerPricingProcedure objGetPartnerPricingProcedure(string argProcedureType, int argLineItemNo, string argClientCode)
        {
            PartnerPricingProcedure argPartnerPricingProcedure = new PartnerPricingProcedure();
            DataSet DataSetToFill = new DataSet();

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

            if (argLineItemNo <= 0)
            {
                goto ErrorHandlers;
            }

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

            DataSetToFill = this.GetPartnerPricingProcedure(argProcedureType, argLineItemNo, argClientCode);

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

            argPartnerPricingProcedure = this.objCreatePartnerPricingProcedure((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argPartnerPricingProcedure);
        }
        public ICollection <PartnerPricingProcedure> colGetPartnerPricingProcedure(DataTable dt, string argUserName, string clientCode)
        {
            List <PartnerPricingProcedure> lst = new List <PartnerPricingProcedure>();
            PartnerPricingProcedure        objPartnerPricingProcedure = null;

            foreach (DataRow dr in dt.Rows)
            {
                objPartnerPricingProcedure = new PartnerPricingProcedure();
                objPartnerPricingProcedure.ProcedureType      = Convert.ToString(dr["ProcedureType"]).Trim();
                objPartnerPricingProcedure.LineItemNo         = Convert.ToInt32(dr["LineItemNo"]);
                objPartnerPricingProcedure.PricingDescription = Convert.ToString(dr["PricingDescription"]).Trim();
                objPartnerPricingProcedure.CalculationType    = Convert.ToString(dr["CalculationType"]).Trim();
                objPartnerPricingProcedure.CalculationValue   = Convert.ToDouble(dr["CalculationValue"]);
                objPartnerPricingProcedure.CalculationOn      = Convert.ToString(dr["CalculationON"]).Trim();
                objPartnerPricingProcedure.CalcLineItemNo     = Convert.ToInt32(dr["CalcLineItemNo"]);
                objPartnerPricingProcedure.IsDeleted          = Convert.ToInt32(dr["IsDeleted"]);
                objPartnerPricingProcedure.ModifiedBy         = Convert.ToString(argUserName).Trim();
                objPartnerPricingProcedure.CreatedBy          = Convert.ToString(argUserName).Trim();
                objPartnerPricingProcedure.ClientCode         = Convert.ToString(clientCode).Trim();
                lst.Add(objPartnerPricingProcedure);
            }
            return(lst);
        }
        public ICollection <PartnerPricingProcedure> colGetPartnerPricingProcedure(string argClientCode)
        {
            List <PartnerPricingProcedure> lst = new List <PartnerPricingProcedure>();
            DataSet DataSetToFill = new DataSet();
            PartnerPricingProcedure tPartnerPricingProcedure = new PartnerPricingProcedure();

            DataSetToFill = this.GetPartnerPricingProcedure(argClientCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }
        public ICollection <ErrorHandler> SavePartnerPricingProcedure(PartnerPricingProcedure argPartnerPricingProcedure)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsPartnerPricingProcedureExists(argPartnerPricingProcedure.ProcedureType, argPartnerPricingProcedure.LineItemNo, argPartnerPricingProcedure.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertPartnerPricingProcedure(argPartnerPricingProcedure, 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();
                    UpdatePartnerPricingProcedure(argPartnerPricingProcedure, 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);
        }