Exemplo n.º 1
0
        private void GetComponents()
        {
            try
            {
                FormHelpers.CursorWait(true);
                var itemno    = BPSUtilitiesV1.NZ(mtxtItemNo.Text, "").ToString();
                var partscode = BPSUtilitiesV1.NZ(mtxtPartCode.Text, "").ToString();
                ListHelper.FillMetroCombo(mcboCatCode, catbal.GetAll().Select(i => new { i.CATCODE, i.CATDESC }).
                                          Where(w => w.CATCODE == "BULK").Distinct().ToList(), "CATCODE", "CATCODE");
                var catcode = BPSUtilitiesV1.NZ(mcboCatCode.SelectedValue, "").ToString();
                item = itembal.GetWithCat(UserSettings.LogInYear, itemno, catcode);

                GetRefCompDetails();
                if (item != null && item.itemCom.Count > 0)
                {
                    if (partscode != "")
                    {
                        itemcom = item.itemCom.Where(w => w.PartNo == partscode).OrderBy(o => o.ItemAddress).FirstOrDefault();
                        if (itemcom != null)
                        {
                            var sourceTable = item.itemCom.Where(w => w.ItemAddress.StartsWith(itemcom.ItemAddress) && w.ItemAddress != itemcom.ItemAddress).ToList();
                            using (var reader = ObjectReader.Create(sourceTable,
                                                                    "DocID",
                                                                    "MatCode",
                                                                    "MatDescription",
                                                                    "ItemUsage",
                                                                    "UnitPrice",
                                                                    "Amount",
                                                                    "Address"))
                            {
                                dt.Load(reader);
                                mgridMatList.DataSource = dt;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageHelpers.ShowError(ex.Message);
            }
            finally
            {
                FormHelpers.CursorWait(false);
            }
        }
Exemplo n.º 2
0
        public frmWIPCosting()
        {
            InitializeComponent();
            itembal    = new ItemBAL();
            itemcombal = new ItemCompositionBAL();
            item       = new tbl_000_H_ITEM();
            itemcom    = new tbl_000_H_ITEM_PART();
            catbal     = new CategoryBAL();

            wip        = new tbl_100_WIP();
            wipbal     = new WIPBAL();
            wipmatbal  = new WIPMaterialsBAL();
            wipmatlist = new List <tbl_100_WIP_Materials>();
            dt         = new DataTable();

            err = new ErrorProviderExtended();
        }
Exemplo n.º 3
0
 public Boolean Save(tbl_000_H_ITEM_PART record)
 {
     using (var dbContextTransaction = db.Database.BeginTransaction())
     {
         try
         {
             db.ItemPartList.Add(record);
             db.SaveChanges();
             dbContextTransaction.Commit();
             return(true);
         }
         catch (Exception ex)
         {
             dbContextTransaction.Rollback();
             throw ex;
         }
     }
 }
Exemplo n.º 4
0
 public Boolean Update(tbl_000_H_ITEM_PART record)
 {
     using (var dbContextTransaction = db.Database.BeginTransaction())
     {
         try
         {
             var existrecord = GetByID(record.DocID);
             db.Entry(existrecord).GetDatabaseValues().SetValues(record);
             db.SaveChanges();
             dbContextTransaction.Commit();
             return(true);
         }
         catch (Exception ex)
         {
             dbContextTransaction.Rollback();
             throw ex;
         }
     }
 }
Exemplo n.º 5
0
 public Boolean Delete(tbl_000_H_ITEM_PART record)
 {
     try
     {
         if (record == null)
         {
             throw new Exception("Invalid Parameter!");
         }
         if (!compdal.IsExistID(record.DocID))
         {
             throw new Exception("Record does not exist!");
         }
         return(compdal.Delete(record));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 6
0
 public Boolean Delete(tbl_000_H_ITEM_PART record)
 {
     using (var dbContextTransaction = db.Database.BeginTransaction())
     {
         try
         {
             //var existrecord = GetByID(record.YEARUSED, record.ItemNo, record.PartNo);
             var existrecord = GetByID(record.DocID);
             db.ItemPartList.Remove(existrecord);
             db.SaveChanges();
             dbContextTransaction.Commit();
             return(true);
         }
         catch (Exception ex)
         {
             dbContextTransaction.Rollback();
             throw ex;
         }
     }
 }
Exemplo n.º 7
0
 public Boolean Save(tbl_000_H_ITEM_PART record)
 {
     try
     {
         if (record == null)
         {
             throw new Exception("Invalid Parameter!");
         }
         if (compdal.IsExistID(record.DocID))
         {
             throw new Exception("No. already taken!");
         }
         if (compdal.IsExistPartName(record.PartName))
         {
             throw new Exception("Name already taken!");
         }
         return(compdal.Save(record));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }