예제 #1
0
 public void SL_SaveCallEstimation(CallEstimation argCallEstimation, DataAccess da, List <ErrorHandler> lstErr)
 {
     try
     {
         if (blnIsCallEstimationExists(argCallEstimation.CallCode, argCallEstimation.ItemNo, argCallEstimation.EstimateNo, argCallEstimation.ClientCode, da) == false)
         {
             SL_InsertCallEstimation(argCallEstimation, da, lstErr);
         }
         else
         {
             SL_UpdateCallEstimation(argCallEstimation, da, lstErr);
         }
     }
     catch (Exception ex)
     {
         objErrorHandler.Type       = ErrorConstant.strAboartType;
         objErrorHandler.MsgId      = 0;
         objErrorHandler.Module     = ErrorConstant.strInsertModule;
         objErrorHandler.ModulePart = ErrorConstant.strDetailModule;
         objErrorHandler.Message    = ex.Message.ToString();
         objErrorHandler.RowNo      = 0;
         objErrorHandler.FieldName  = "";
         objErrorHandler.LogCode    = "";
         lstErr.Add(objErrorHandler);
     }
 }
예제 #2
0
        private CallEstimation objCreateCallEstimation(DataRow dr)
        {
            CallEstimation tCallEstimation = new CallEstimation();

            tCallEstimation.SetObjectInfo(dr);

            return(tCallEstimation);
        }
예제 #3
0
        public void SL_UpdateCallEstimation(CallEstimation argCallEstimation, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[18];
            param[0]  = new SqlParameter("@CallCode", argCallEstimation.CallCode);
            param[1]  = new SqlParameter("@ItemNo", argCallEstimation.ItemNo);
            param[2]  = new SqlParameter("@EstimateNo", argCallEstimation.EstimateNo);
            param[3]  = new SqlParameter("@EstPartsCost", argCallEstimation.EstPartsCost);
            param[4]  = new SqlParameter("@EstLabourCost", argCallEstimation.EstLabourCost);
            param[5]  = new SqlParameter("@EstShippingCost", argCallEstimation.EstShippingCost);
            param[6]  = new SqlParameter("@EstHandlingCost", argCallEstimation.EstHandlingCost);
            param[7]  = new SqlParameter("@EstTravelCost", argCallEstimation.EstTravelCost);
            param[8]  = new SqlParameter("@EstTotal", argCallEstimation.EstTotal);
            param[9]  = new SqlParameter("@EstAppStatus", argCallEstimation.EstAppStatus);
            param[10] = new SqlParameter("@AppDate", argCallEstimation.AppDate);
            param[11] = new SqlParameter("@PartnerCode", argCallEstimation.PartnerCode);
            param[12] = new SqlParameter("@ClientCode", argCallEstimation.ClientCode);
            param[13] = new SqlParameter("@CreatedBy", argCallEstimation.CreatedBy);
            param[14] = new SqlParameter("@ModifiedBy", argCallEstimation.ModifiedBy);

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

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

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

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


            string strMessage  = Convert.ToString(param[16].Value);
            string strType     = Convert.ToString(param[15].Value);
            string strRetValue = Convert.ToString(param[17].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);
        }
예제 #4
0
        public CallEstimation objGetCallEstimation(string argCallCode, int argItemNo, int argEstimateNo, string argClientCode)
        {
            CallEstimation argCallEstimation = new CallEstimation();
            DataSet        DataSetToFill     = new DataSet();

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

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

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

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

            DataSetToFill = this.GetCallEstimation(argCallCode, argItemNo, argEstimateNo, argClientCode);

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

            argCallEstimation = this.objCreateCallEstimation((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argCallEstimation);
        }
예제 #5
0
        public void colGetCallEstimation(string argCallCode, int argItemNo, string argClientCode, ref CallEstimationCol argCallEstimationCol)
        {
            DataSet        DataSetToFill   = new DataSet();
            CallEstimation tCallEstimation = new CallEstimation();

            DataSetToFill = this.GetCallEstimation(argCallCode, argItemNo, argClientCode);

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

Finish:
            DataSetToFill = null;
        }
예제 #6
0
        public PartnerErrorResult SaveCallEstimation(CallEstimation argCallEstimation)
        {
            List <ErrorHandler> lstErr   = new List <ErrorHandler>();
            PartnerErrorResult  errorcol = new PartnerErrorResult();
            DataAccess          da       = new DataAccess();

            try
            {
                if (blnIsCallEstimationExists(argCallEstimation.CallCode, argCallEstimation.ItemNo, argCallEstimation.EstimateNo, argCallEstimation.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertCallEstimation(argCallEstimation, da, lstErr);
                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            errorcol.colErrorHandler.Add(objerr);
                            da.ROLLBACK_TRANSACTION();
                            return(errorcol);
                        }

                        if (objerr.Type == "A")
                        {
                            errorcol.colErrorHandler.Add(objerr);
                            da.ROLLBACK_TRANSACTION();
                            return(errorcol);
                        }
                    }
                }
                else
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    UpdateCallEstimation(argCallEstimation, da, lstErr);
                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            errorcol.colErrorHandler.Add(objerr);
                            da.ROLLBACK_TRANSACTION();
                            return(errorcol);
                        }

                        if (objerr.Type == "A")
                        {
                            errorcol.colErrorHandler.Add(objerr);
                            da.ROLLBACK_TRANSACTION();
                            return(errorcol);
                        }
                    }
                }
                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);
                errorcol.colErrorHandler.Add(objErrorHandler);
            }
            finally
            {
                if (da != null)
                {
                    da.Close_Connection();
                    da = null;
                }
            }
            return(errorcol);
        }