Ejemplo n.º 1
0
 public void SaveBOM_Serial(BOM_Serial argBOM_Serial, DataAccess da, List <ErrorHandler> lstErr)
 {
     try
     {
         if (blnIsBOM_SerialExists(argBOM_Serial.MaterialCode, argBOM_Serial.MRevisionCode, argBOM_Serial.SerialFrom, argBOM_Serial.ClientCode, da) == false)
         {
             InsertBOM_Serial(argBOM_Serial, da, lstErr);
         }
         else
         {
             UpdateBOM_Serial(argBOM_Serial, da, lstErr);
         }
     }
     catch (Exception ex)
     {
         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);
     }
 }
Ejemplo n.º 2
0
        private BOM_Serial objCreateBOM_Serial(DataRow dr)
        {
            BOM_Serial tBOM_Serial = new BOM_Serial();

            tBOM_Serial.SetObjectInfo(dr);

            return(tBOM_Serial);
        }
Ejemplo n.º 3
0
        public void UpdateBOM_Serial(BOM_Serial argBOM_Serial, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[11];
            param[0] = new SqlParameter("@MaterialCode", argBOM_Serial.MaterialCode);
            param[1] = new SqlParameter("@MRevisionCode", argBOM_Serial.MRevisionCode);
            param[2] = new SqlParameter("@SerialFrom", argBOM_Serial.SerialFrom);
            param[3] = new SqlParameter("@SerialTo", argBOM_Serial.SerialTo);
            param[4] = new SqlParameter("@BatchDate", argBOM_Serial.BatchDate);
            param[5] = new SqlParameter("@ClientCode", argBOM_Serial.ClientCode);
            param[6] = new SqlParameter("@CreatedBy", argBOM_Serial.CreatedBy);
            param[7] = new SqlParameter("@ModifiedBy", argBOM_Serial.ModifiedBy);

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

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

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

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

            string strMessage  = Convert.ToString(param[9].Value);
            string strType     = Convert.ToString(param[8].Value);
            string strRetValue = Convert.ToString(param[10].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);
        }
Ejemplo n.º 4
0
        public BOM_Serial objGetBOM_Serial(string argMaterialCode, string argMRevisionCode, string argSerialFrom, string argClientCode)
        {
            BOM_Serial argBOM_Serial = new BOM_Serial();
            DataSet    DataSetToFill = new DataSet();

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

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

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

            DataSetToFill = this.GetBOM_Serial(argMaterialCode, argMRevisionCode, argSerialFrom, argClientCode);

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

            argBOM_Serial = this.objCreateBOM_Serial((DataRow)DataSetToFill.Tables[0].Rows[0]);

            goto Finish;

ErrorHandlers:

Finish:
            DataSetToFill = null;


            return(argBOM_Serial);
        }
Ejemplo n.º 5
0
        public ICollection <BOM_Serial> colGetBOM_Serial(string argMaterialCode, string argMRevisionCode, string argClientCode)
        {
            List <BOM_Serial> lst           = new List <BOM_Serial>();
            DataSet           DataSetToFill = new DataSet();
            BOM_Serial        tBOM_Serial   = new BOM_Serial();

            DataSetToFill = this.GetBOM_Serial(argMaterialCode, argMRevisionCode, argClientCode);

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

Finish:
            DataSetToFill = null;


            return(lst);
        }
Ejemplo n.º 6
0
        /**********/

        public PartnerErrorResult_MM SaveBillsofMaterial(BillsofMaterialCol ColBillsofMaterial, DataTable dtSerialNo)
        {
            List <ErrorHandler>   lstErr   = new List <ErrorHandler>();
            PartnerErrorResult_MM errorcol = new PartnerErrorResult_MM();
            DataAccess            da       = new DataAccess();

            try
            {
                da.Open_Connection();
                da.BEGIN_TRANSACTION();
                string strReturnVal = "";

                foreach (BillsofMaterial argBillsofMaterial in ColBillsofMaterial.colBillsofMaterial)
                {
                    if (argBillsofMaterial.IsDeleted == 0)
                    {
                        if (blnIsBillsofMaterialExists(argBillsofMaterial.MastMaterialCode, argBillsofMaterial.MaterialCode, argBillsofMaterial.MRevisionCode, argBillsofMaterial.ClientCode, da) == false)
                        {
                            strReturnVal = InsertBillsofMaterial(argBillsofMaterial, ref da, ref lstErr);
                        }
                        else
                        {
                            strReturnVal = UpdateBillsofMaterial(argBillsofMaterial, ref da, ref lstErr);
                        }
                    }
                    else
                    {
                        DeleteBillsofMaterial(argBillsofMaterial.MastMaterialCode, argBillsofMaterial.MaterialCode, argBillsofMaterial.MRevisionCode, argBillsofMaterial.ClientCode, argBillsofMaterial.IsDeleted, ref da, ref 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);
                    }
                }

                if (strReturnVal != "")
                {
                    foreach (DataRow dr in dtSerialNo.Rows)
                    {
                        BOM_Serial objBOM_Serial = new BOM_Serial();
                        objBOM_Serial.MaterialCode  = Convert.ToString(dr["MaterialCode"]).Trim();
                        objBOM_Serial.MRevisionCode = Convert.ToString(dr["MRevisionCode"]).Trim();
                        objBOM_Serial.SerialFrom    = Convert.ToString(dr["SerialFrom"]).Trim();
                        objBOM_Serial.SerialTo      = Convert.ToString(dr["SerialTo"]).Trim();
                        objBOM_Serial.BatchDate     = Convert.ToDateTime(dr["BatchDate"]).ToString("yyyy-MM-dd");
                        objBOM_Serial.ClientCode    = Convert.ToString(dr["ClientCode"]).Trim();
                        objBOM_Serial.CreatedBy     = Convert.ToString(dr["CreatedBy"]).Trim();
                        objBOM_Serial.ModifiedBy    = Convert.ToString(dr["ModifiedBy"]).Trim();
                        objBOM_Serial.IsDeleted     = Convert.ToInt32(dr["IsDeleted"]);

                        if (objBOM_Serial.IsDeleted == 0)
                        {
                            objBOM_SerialManager.SaveBOM_Serial(objBOM_Serial, da, lstErr);
                        }
                        else
                        {
                            objBOM_SerialManager.DeleteBOM_Serial(objBOM_Serial.MaterialCode, objBOM_Serial.MRevisionCode, objBOM_Serial.ClientCode, objBOM_Serial.IsDeleted);
                        }
                    }

                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(errorcol);
                        }

                        if (objerr.Type == "A")
                        {
                            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);
        }