Ejemplo n.º 1
0
 public void SaveSOSchedule(SOSchedule argSOSchedule, DataAccess da, List <ErrorHandler> lstErr)
 {
     try
     {
         if (blnIsSOScheduleExists(argSOSchedule.SODocCode, argSOSchedule.ItemNo, argSOSchedule.SOSItemNo, argSOSchedule.ClientCode, da) == false)
         {
             InsertSOSchedule(argSOSchedule, da, lstErr);
         }
         else
         {
             UpdateSOSchedule(argSOSchedule, 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);
     }
 }
Ejemplo n.º 2
0
        public SOSchedule objGetSOSchedule(string argSODocCode, string argClientCode)
        {
            SOSchedule argSOSchedule = new SOSchedule();
            DataSet    DataSetToFill = new DataSet();

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


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

            DataSetToFill = this.GetSOSchedule(argSODocCode, argClientCode);

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

            argSOSchedule = this.objCreateSOSchedule((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argSOSchedule);
        }
Ejemplo n.º 3
0
        private SOSchedule objCreateSOSchedule(DataRow dr)
        {
            SOSchedule tSOSchedule = new SOSchedule();

            tSOSchedule.SetObjectInfo(dr);

            return(tSOSchedule);
        }
Ejemplo n.º 4
0
        //public ICollection<ErrorHandler> SaveSOSchedule(SOSchedule argSOSchedule)
        //{
        //    List<ErrorHandler> lstErr = new List<ErrorHandler>();
        //    DataAccess da = new DataAccess();
        //    try
        //    {
        //        if (blnIsSOScheduleExists(argSOSchedule.SODocCode, argSOSchedule.ItemNo, argSOSchedule.ClientCode) == false)
        //        {

        //            da.Open_Connection();
        //            da.BEGIN_TRANSACTION();
        //            InsertSOSchedule(argSOSchedule, 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();
        //            UpdateSOSchedule(argSOSchedule, 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;
        //}


        public string InsertSOSchedule(SOSchedule argSOSchedule, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[15];
            param[0]  = new SqlParameter("@SOSItemNo", argSOSchedule.SOSItemNo);
            param[1]  = new SqlParameter("@SODocCode", argSOSchedule.SODocCode);
            param[2]  = new SqlParameter("@ItemNo", argSOSchedule.ItemNo);
            param[3]  = new SqlParameter("@ClientCode", argSOSchedule.ClientCode);
            param[4]  = new SqlParameter("@DeliveryDate", argSOSchedule.DeliveryDate);
            param[5]  = new SqlParameter("@SchQuantity", argSOSchedule.SchQuantity);
            param[6]  = new SqlParameter("@DeliveryQuantity", argSOSchedule.DeliveryQuantity);
            param[7]  = new SqlParameter("@RoundedQty", argSOSchedule.RoundedQty);
            param[8]  = new SqlParameter("@ConfirmedQty", argSOSchedule.ConfirmedQty);
            param[9]  = new SqlParameter("@SchStatus", argSOSchedule.SchStatus);
            param[10] = new SqlParameter("@CreatedBy", argSOSchedule.CreatedBy);
            param[11] = new SqlParameter("@ModifiedBy", argSOSchedule.ModifiedBy);

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

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

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

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


            string strMessage  = Convert.ToString(param[13].Value);
            string strType     = Convert.ToString(param[12].Value);
            string strRetValue = Convert.ToString(param[14].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);
        }
Ejemplo n.º 5
0
        public ICollection <SOSchedule> colGetSOSchedule(string argClientCode, string argSODocCode, List <SOSchedule> lst)
        {
            //List<SOSchedule> lst = new List<SOSchedule>();
            DataSet    DataSetToFill = new DataSet();
            SOSchedule tSOSchedule   = new SOSchedule();

            DataSetToFill = this.GetSOSchedule(argClientCode, argSODocCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }