public int Insert(CostGroupModel model)
        {
            string sql =
                @"INSERT INTO  prj_cost_groups 
                       ( cost_id 
                       , cost_code 
                       , cost_desc 
                       , cost_class 
                       , making_flag
                       , last_update_date 
                       , last_updated_by 
                       , creation_date 
                       , created_by )
                 VALUES
                       ( @cost_id
                       , @cost_code
                       , @cost_desc
                       , @cost_class
                       , @making_flag
                       , @last_update_date
                       , @last_updated_by
                       , @creation_date
                       , @created_by)";

            return(db.Insert(sql, Take(model)));
        }
        public void Delete(CostGroupModel model)
        {
            string sql = @"DELETE FROM prj_cost_groups WHERE cost_id = @cost_id";

            object[] parms = { "@cost_id", model.Id };
            db.Update(sql, parms);
        }
Пример #3
0
        private int ValidCostGroup(string costCode)
        {
            CostGroupModel result = _view.costs.Where(x => x.CostCode == costCode).FirstOrDefault();

            if (result != null)
            {
                return(result.Id);
            }
            else
            {
                return(0);
            }
        }
        public void Update(CostGroupModel model)
        {
            string sql =
                @"UPDATE prj_cost_groups
                   SET cost_id = @cost_id
                      ,cost_code = @cost_code
                      ,cost_desc = @cost_desc
                      ,cost_class = @cost_class
                      ,making_flag = @making_flag
                      ,last_update_date = @last_update_date
                      ,last_updated_by = @last_updated_by
                 WHERE cost_id = @cost_id";

            db.Update(sql, Take(model));
        }
 private object[] Take(CostGroupModel model)
 {
     return(new object[]
     {
         "@cost_id", model.Id,
         "@cost_code", model.CostCode,
         "@cost_desc", model.CostDescription,
         "@cost_class", model.CostClass,
         "@last_update_date", model.LastUpdateDate,
         "@last_updated_by", model.LastUpdateBy,
         "@creation_date", model.CreationDate,
         "@created_by", model.CreatedBy,
         "@making_flag", model.MakingFlag ? "Y" : "N"
     });
 }
Пример #6
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (grvData.FocusedRowHandle < 0)
            {
                return;
            }
            _rownIndex = grvData.FocusedRowHandle;

            CostGroupModel     model = (CostGroupModel)CostGroupBO.Instance.FindByPK(TextUtils.ToInt(grvData.GetFocusedRowCellValue(colID)));
            frmCostGroupDetail frm   = new frmCostGroupDetail();

            frm.CostGroup = model;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                loadData();
            }
        }
Пример #7
0
 private void frmProductPrice_Load(object sender, EventArgs e)
 {
     GridLocalizer.Active = new MyGridLocalizer();
     DocUtils.InitFTPQLSX();
     this.Text = "Giá sản phẩm: " + Product.Code + " - " + Product.Name;
     loadCostGroup();
     if (Product.ID > 0)
     {
         CostGroupModel costGroup = (CostGroupModel)CostGroupBO.Instance.FindByPK(Product.CostGroupID);
         if (costGroup != null)
         {
             lblTradePercent.Text = costGroup.PercentTrade.ToString() + "%";
             lblUserPercent.Text  = costGroup.PercentUser.ToString() + "%";
             lblVAT.Text          = costGroup.VAT.ToString() + "%";
         }
     }
     using (WaitDialogForm fWait = new WaitDialogForm("Vui lòng chờ trong giây lát...", "Đang load giá..."))
     {
         loadGrid();
     }
 }
Пример #8
0
 protected CostGroupFacade(CostGroupModel model) : base(model)
 {
 }
        private void AddReceivingLine(List <POLineModel> poLines)
        {
            if (poLines.Count > 0)
            {
                POReceiptHeaderModel recHead = _view.headSeleted;
                foreach (var poLine in poLines)
                {
                    POReceiptLineModel recLine = new POReceiptLineModel();
                    recLine.CreatedBy          = _view.EpiSession.User.Id;
                    recLine.LastUpdatedBy      = _view.EpiSession.User.Id;
                    recLine.ReceiptHeaderId    = _view.headSeleted.ReceiptHeaderId;
                    recLine.LineNum            = 0;                                         //When to generate line num after Received status
                    recLine.QuantityShipped    = poLine.Quantity - poLine.QuantityReceived; //Default 0
                    recLine.QuantityReceived   = poLine.QuantityReceived;
                    recLine.UnitOfMeasure      = string.IsNullOrEmpty(poLine.Uom) ? "PCS" : poLine.Uom;
                    recLine.ItemDescription    = poLine.ItemDescription;
                    recLine.ItemId             = poLine.ItemId;
                    recLine.SourceDocumentCode = "PURCHASING";
                    recLine.PoHeaderId         = poLine.PoHeaderId;
                    recLine.PoLineId           = poLine.PoLineId;
                    recLine.ToSubinventory     = poLine.RefProjectNum;
                    recLine.ProjectId          = poLine.RefProjectId;
                    recLine.ProjectNum         = poLine.RefProjectNum;
                    recLine.ShipmentUnitPrice  = poLine.UnitPrice;
                    recLine.TaxName            = poLine.TaxCode;
                    recLine.TaxAmount          = poLine.TaxAmount;
                    recLine.InvoiceStatusCode  = "N";
                    recLine.PrjCostId          = poLine.ProjCostId;
                    recLine.QuantityOrdered    = poLine.Quantity;
                    recLine.CostCode           = poLine.CostCode;
                    recLine.Attribute1         = poLine.BOM; /*Bom Number*/

                    CostGroupModel cost = _view.costs.Where(x => x.CostCode == poLine.CostCode).FirstOrDefault();
                    if (cost == null)
                    {
                        MessageBox.Show("Cost Code : " + cost.CostCode +
                                        " in PO Line : " + poLine.PoLineNum + " dose not exist.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        break;
                    }

                    int dup = _view.rcvLines.Where(x => x.PoLineId == poLine.PoLineId).ToList().Count();
                    if (dup > 0)
                    {
                        MessageBox.Show("PO Line : " + poLine.PoLineNum + " was existing within Receive.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        break;
                    }

                    recLine.QcRequireInspcFlag = cost.MakingFlag;

                    if (recLine.QcRequireInspcFlag)
                    {
                        recLine.QcInspectionStatus = 2; //Default PASS
                    }
                    else
                    {
                        recLine.QcInspectionStatus = 0; //NOTHING
                    }

                    if (_view.rcvLines.Count() == 0)
                    {
                        recHead.SourceType = poLine.LineType;
                        if (recLine.QcRequireInspcFlag)
                        {
                            recHead.QCInspectionFlag = true;
                            recHead.InspectionStatus = "HOLD";
                        }
                        else
                        {
                            recHead.QCInspectionFlag = false;
                            recHead.InspectionStatus = "NO INSPECTION";
                        }
                    }
                    else
                    {
                        if (poLine.LineType.Trim() != recHead.SourceType.Trim())
                        {
                            MessageBox.Show("PO Type is not match Receive.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            break;
                        }

                        if (cost.MakingFlag != recHead.QCInspectionFlag)
                        {
                            MessageBox.Show("PO Type is not match Receive for Job process.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            break;
                        }
                    }

                    _repository.InsertRcvLine(recLine);
                }

                _view.rcvLines = _repository.GetRcvLineByHeaderID(recHead.ReceiptHeaderId);
                _view.BindingRcvLines(_view.rcvLines);
                _repository.UpdateRcvHead(recHead);
                _view.headSeleted = recHead;
            }
        }