示例#1
0
        public MRBasicProductCollec Get(long MRNO)
        {
            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@MRNO", MRNO)
                };


                DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_MRBasicProduct_By_MR", paramList);

                MRBasicProductCollec objMRBasicCollec = new MRBasicProductCollec();
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        MRBasicProduct objMRBasicProduct = new MRBasicProduct();
                        objMRBasicProduct.BasicProduct = objBasicProduct_DL.Get(Convert.ToString(dt.Rows[i]["MRMaterialCode"]));
                        objMRBasicProduct.Description  = Convert.ToString(dt.Rows[i]["MRDescription"]);
                        objMRBasicProduct.MR           = objMR_DL.Get(Convert.ToInt64(dt.Rows[i]["MRNO"]));
                        objMRBasicProduct.MRBINNo      = Convert.ToString(dt.Rows[i]["MRBINNo"]);
                        objMRBasicProduct.ReqdQty      = Convert.ToDecimal(dt.Rows[i]["MRReqdQty"]);
                        objMRBasicProduct.IssuedQty    = Convert.ToDecimal(dt.Rows[i]["MRIssuedQty"]);
                        objMRBasicProduct.UnitCode     = objMRBasicProduct.BasicProduct.BasicProductUnit.UnitCode;
                        objMRBasicProduct.Item         = objMRBasicProduct.BasicProduct.BasicProductCode + " - " + objMRBasicProduct.BasicProduct.BasicProductDescription;
                        objMRBasicProduct.ItemCode     = objMRBasicProduct.BasicProduct.BasicProductCode;

                        if (dt.Rows[i]["MRUnitRate"] != null)
                        {
                            objMRBasicProduct.UniRate = Convert.ToDecimal(dt.Rows[i]["MRUnitRate"]);
                        }
                        else
                        {
                            objMRBasicProduct.UniRate = 0;
                        }

                        objMRBasicCollec.Add(objMRBasicProduct);
                    }
                }
                return(objMRBasicCollec);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
示例#2
0
        public long GenerateMR(PRPDBatch objPRPD)
        {
            MR objMR = new MR();
            MRMaterialCollec      objMRMatCollec           = new MRMaterialCollec();
            MRFinishProductCollec objMRFinishProductCollec = new MRFinishProductCollec();
            MRBasicProductCollec  objMRBasicProductCollec  = new MRBasicProductCollec();
            BatchMR       objBatchMR      = new BatchMR();
            Department_DL objDepDL        = new Department_DL(ConnectionStringClass.GetConnection());
            MR_DL         objMRDL         = new MR_DL(ConnectionStringClass.GetConnection());
            MRMaterial_DL objMRMaterialDL = new MRMaterial_DL(ConnectionStringClass.GetConnection());
            Store_DL      objStoreDL      = new Store_DL(ConnectionStringClass.GetConnection());

            try
            {
                objMR.MRDate           = DateTime.Now;
                objMR.MRDepartmentFrom = objDepDL.GetByDepType("PRPD");
                objMR.MREnterdBy       = CurrentUser.EmployeeID;
                objMR.MRStatus         = MR.Status.Initial;

                objMR.MRStore    = objStore;
                objMR.MRType     = MR.Type.Material;
                objMR.MRRemarks  = "Material Requition(Materials) for PRPD Batch NO " + objPRPD.PRPDBatchID.ToString();
                objMR.OriginType = MR.Origin.ToBatch;

                MRMaterial obj = new MRMaterial();
                obj.Description = "PRPD Batch Material Requition";
                obj.Material    = objPRPD.PRPDBatchMaterial;
                obj.MRBINNo     = "";
                obj.ReqdQty     = objPRPD.PRPDBatchQty;


                long MRNO = objMRDL.Add_M(objMR);
                if (MRNO > 0)
                {
                    objMR.MRNO = MRNO;
                    obj.MR     = objMR;
                    objMRMaterialDL.Add(obj);
                }
                return(MRNO);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
示例#3
0
        public MRBasicProductCollec Get()
        {
            try
            {
                DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_MRBasicProduct");

                MRBasicProductCollec objMRBasicCollec = new MRBasicProductCollec();

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    MRBasicProduct objMRBasicProduct = new MRBasicProduct();
                    objMRBasicProduct.BasicProduct = objBasicProduct_DL.Get(Convert.ToString(dt.Rows[i]["MRBasicProductID"]));
                    objMRBasicProduct.Description  = Convert.ToString(dt.Rows[i]["MRDescription"]);
                    objMRBasicProduct.MR           = objMR_DL.Get(Convert.ToInt64(dt.Rows[i]["MRNO"]));
                    objMRBasicProduct.MRBINNo      = Convert.ToString(dt.Rows[i]["MRBINNo"]);
                    objMRBasicProduct.ReqdQty      = Convert.ToDecimal(dt.Rows[i]["MRReqdQty"]);
                    objMRBasicProduct.IssuedQty    = Convert.ToDecimal(dt.Rows[i]["MRIssuedQty"]);


                    if (dt.Rows[i]["MRUnitRate"] != null)
                    {
                        objMRBasicProduct.UniRate = Convert.ToDecimal(dt.Rows[i]["MRUnitRate"]);
                    }
                    else
                    {
                        objMRBasicProduct.UniRate = 0;
                    }

                    objMRBasicCollec.Add(objMRBasicProduct);
                }
                return(objMRBasicCollec);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }