Пример #1
0
        //updatebom
        public bool UpdateBOM(eSunSpeedDomain.BillofMaterialModel objBOM)
        {
            string Query     = string.Empty;
            bool   isUpdated = true;

            try
            {
                DBParameterCollection paramCollection = new DBParameterCollection();


                paramCollection.Add(new DBParameter("@BOMName", objBOM.BOMName));
                paramCollection.Add(new DBParameter("@ItemProduct", objBOM.ItemProduct));
                paramCollection.Add(new DBParameter("@Quantity", objBOM.Quantity, System.Data.DbType.Decimal));
                paramCollection.Add(new DBParameter("@ItemUnit", objBOM.ItemUnit));
                paramCollection.Add(new DBParameter("@Expenses", objBOM.Expenses, System.Data.DbType.Decimal));
                paramCollection.Add(new DBParameter("@SpecifyMCGenerated", objBOM.SpecifyMCGenerated, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@SpecifyDefaultMCforItemConsumed", objBOM.SpecifyDefaultMCforItemConsumed, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@AppMc", objBOM.AppMc));
                paramCollection.Add(new DBParameter("@SNo", objBOM.SNo));
                paramCollection.Add(new DBParameter("@ItemName", objBOM.ItemName));
                paramCollection.Add(new DBParameter("@Qty", objBOM.Qty, System.Data.DbType.Decimal));
                paramCollection.Add(new DBParameter("@Unit", objBOM.Unit, System.Data.DbType.Decimal));
                paramCollection.Add(new DBParameter("@TotalofConsumedqtyUnit", objBOM.TotalofConsumedqtyUnit, System.Data.DbType.Decimal));
                paramCollection.Add(new DBParameter("@ModifiedBy", "Admin"));
                paramCollection.Add(new DBParameter("@Bom_Id", objBOM.Bom_Id));


                Query = "UPDATE BillsofMaterial SET [BOMName]=@BOMName,[ItemProduct]=@ItemProduct,[Quantity]=@Quantity,[ItemUnit]=@ItemUnit,[Expenses]=@Expenses,[SpecifyMCGenerated]=@SpecifyMCGenerated, " +
                        "[SpecifyDefaultMCforItemConsumed]=@SpecifyDefaultMCforItemConsumed,[AppMc]=@AppMc,[SNo]=@SNo,[ItemName]=@ItemName, " +
                        "[Qty]=@Qty,[Unit]=@Unit,[TotalofConsumedqtyUnit]=@TotalofConsumedqtyUnit,[ModifiedBy]=@ModifiedBy " +
                        "WHERE BOM_Id=@BOM_Id";



                if (_dbHelper.ExecuteNonQuery(Query, paramCollection) > 0)
                {
                    isUpdated = true;
                }
            }
            catch (Exception ex)
            {
                isUpdated = false;
                throw ex;
            }

            return(isUpdated);
        }
Пример #2
0
        //Save
        public bool SaveBOM(eSunSpeedDomain.BillofMaterialModel objBOM)
        {
            string Query   = string.Empty;
            bool   isSaved = true;

            try
            {
                DBParameterCollection paramCollection = new DBParameterCollection();

                paramCollection.Add(new DBParameter("@BOMName", objBOM.BOMName));
                paramCollection.Add(new DBParameter("@Itemtoproduce", objBOM.Itemtoproduce));
                paramCollection.Add(new DBParameter("@Quantity", objBOM.Quantity, System.Data.DbType.Decimal));
                paramCollection.Add(new DBParameter("@ItemUnit", objBOM.ItemUnit));
                paramCollection.Add(new DBParameter("@Expenses", objBOM.Expenses, System.Data.DbType.Decimal));
                paramCollection.Add(new DBParameter("@SpecifyMCGenerated", objBOM.SpecifyMCGenerated, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@SpecifyDefaultMCforItemConsumed", objBOM.SpecifyDefaultMCforItemConsumed, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@AppMc", objBOM.AppMc));
                paramCollection.Add(new DBParameter("@IGTotalQty", objBOM.IGTotalQty, System.Data.DbType.Decimal));
                paramCollection.Add(new DBParameter("@ICTotalQty", objBOM.ICTotalQty, System.Data.DbType.Decimal));
                paramCollection.Add(new DBParameter("@CreatedBy", "Admin"));
                paramCollection.Add(new DBParameter("@CreatedDate", DateTime.Now, DbType.DateTime));
                paramCollection.Add(new DBParameter("@ModifiedBy", ""));
                paramCollection.Add(new DBParameter("@ModifiedDate", DateTime.Now, DbType.DateTime));

                Query = "INSERT INTO billsofmaterial(`BomName`,`Itemtoproduce`,`Quantity`,`ItemUnit`,`Expenses`,`SpecifyMCGenerated`,`SpecifyDefaultMCforItemConsumed`,`AppMc`,`IGTotalQty`,`ICTotalQty`,`CreatedBy`,`CreatedDate`,`ModifiedBy`,`ModifiedDate`) " +
                        "VALUES(@BOMName,@Itemtoproduce,@Quantity,@ItemUnit,@Expenses,@SpecifyMCGenerated,@SpecifyDefaultMCforItemConsumed,@AppMc,@IGTotalQty,@ICTotalQty,@CreatedBy,@CreatedDate,@ModifiedBy,@ModifiedDate)";
                if (_dbHelper.ExecuteNonQuery(Query, paramCollection) > 0)
                {
                    SaveRawMaterialConsumed(objBOM.MaterialConsumed);
                    SaveMaterialGenerated(objBOM.MaterialGenerated);
                    isSaved = true;
                }
            }
            catch (Exception ex)
            {
                isSaved = false;
                throw ex;
            }

            return(isSaved);
        }
Пример #3
0
        //Save
        public bool SaveBOM(eSunSpeedDomain.BillofMaterialModel objBOM)
        {
            string Query   = string.Empty;
            bool   isSaved = true;

            try
            {
                DBParameterCollection paramCollection = new DBParameterCollection();

                paramCollection.Add(new DBParameter("@BOMName", objBOM.BOMName));
                paramCollection.Add(new DBParameter("@ItemProduct", objBOM.ItemProduct));
                paramCollection.Add(new DBParameter("@Quantity", objBOM.Quantity));
                paramCollection.Add(new DBParameter("@ItemUnit", objBOM.ItemUnit));
                paramCollection.Add(new DBParameter("@Expenses", objBOM.Expenses));
                paramCollection.Add(new DBParameter("@SpecifyMCGenerated", objBOM.SpecifyMCGenerated));
                paramCollection.Add(new DBParameter("@SpecifyDefaultMCforItemConsumed", objBOM.SpecifyDefaultMCforItemConsumed));
                //paramCollection.Add(new DBParameter("@AppMc", objBOM.AppMc));
                //paramCollection.Add(new DBParameter("@SNo", objBOM.SNo));
                //paramCollection.Add(new DBParameter("@ItemName", objBOM.ItemName));
                //paramCollection.Add(new DBParameter("@Qty", objBOM.Qty, System.Data.DbType.Decimal));
                //paramCollection.Add(new DBParameter("@Unit", objBOM.Unit, System.Data.DbType.Decimal));
                //paramCollection.Add(new DBParameter("@TotalofConsumedqtyUnit", objBOM.TotalofConsumedqtyUnit, System.Data.DbType.Decimal));
                paramCollection.Add(new DBParameter("@CreatedBy", "Admin"));

                Query = "INSERT INTO BillsofMaterial(`BomName`,`ItemProduct`,`Quantity`,`ItemUnit`,`Expenses`,`SpecifyMCGenerated`,`SpecifyDefaultMCforItemConsumed`,`CreatedBy`) " +
                        "VALUES(@BOMName,@ItemProduct,@Quantity,@ItemUnit,@Expenses,@SpecifyMCGenerated,@SpecifyDefaultMCforItemConsumed,@CreatedBy)";

                if (_dbHelper.ExecuteNonQuery(Query, paramCollection) > 0)
                {
                    isSaved = true;
                }
            }
            catch (Exception ex)
            {
                isSaved = false;
                throw ex;
            }

            return(isSaved);
        }
Пример #4
0
        //update bom
        public bool UpdateBOM(eSunSpeedDomain.BillofMaterialModel objBOM)
        {
            string Query     = string.Empty;
            bool   isUpdated = true;

            try
            {
                DBParameterCollection paramCollection = new DBParameterCollection();

                paramCollection.Add(new DBParameter("@BOMName", objBOM.BOMName));
                paramCollection.Add(new DBParameter("@Itemtoproduce", objBOM.Itemtoproduce));
                paramCollection.Add(new DBParameter("@Quantity", objBOM.Quantity, System.Data.DbType.Decimal));
                paramCollection.Add(new DBParameter("@ItemUnit", objBOM.ItemUnit));
                paramCollection.Add(new DBParameter("@Expenses", objBOM.Expenses, System.Data.DbType.Decimal));
                paramCollection.Add(new DBParameter("@SpecifyMCGenerated", objBOM.SpecifyMCGenerated, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@SpecifyDefaultMCforItemConsumed", objBOM.SpecifyDefaultMCforItemConsumed, System.Data.DbType.Boolean));
                paramCollection.Add(new DBParameter("@AppMc", objBOM.AppMc));
                paramCollection.Add(new DBParameter("@IGTotalQty", objBOM.IGTotalQty, System.Data.DbType.Decimal));
                paramCollection.Add(new DBParameter("@ICTotalQty", objBOM.ICTotalQty, System.Data.DbType.Decimal));
                paramCollection.Add(new DBParameter("@CreatedBy", ""));
                paramCollection.Add(new DBParameter("@CreatedDate", DateTime.Now, DbType.DateTime));
                paramCollection.Add(new DBParameter("@ModifiedBy", "Admin"));
                paramCollection.Add(new DBParameter("@ModifiedDate", DateTime.Now, DbType.DateTime));
                paramCollection.Add(new DBParameter("@BillsId", objBOM.id));

                System.Data.IDataReader dr =
                    _dbHelper.ExecuteDataReader("spUpdateBillsOfMaterial", _dbHelper.GetConnObject(), paramCollection, System.Data.CommandType.StoredProcedure);
                UpdateBillsofMaterialConsumed(objBOM.MaterialConsumed, objBOM.id);
                UpdateBillsofMaterialGenerate(objBOM.MaterialGenerated, objBOM.id);
            }
            catch (Exception ex)
            {
                isUpdated = false;
                throw ex;
            }

            return(isUpdated);
        }