Пример #1
0
 /// <summary>
 /// Cập nhật thông tin
 /// </summary>
 /// <param name="issueDetail"></param>
 public void Update(IssueDetail issueDetail)
 {
     _context.IssueDetails.Attach(issueDetail);
     _context.Entry(issueDetail).State = EntityState.Modified;
     SaveChanges();
 }
Пример #2
0
        /// <summary>
        /// Thêm Hóa đơn nhập chi tiết
        /// </summary>
        /// <param name="issueId">Mã hóa đơn nhập</param>
        /// <param name="productId">Mã mặt hàng</param>
        /// <param name="quantityIssue">Số lượng nhập</param>
        /// <param name="price">Thành tiền</param>
        /// <param name="total"></param>
        /// <param name="departmentId"></param>
        private void InsertIssueDetails(string issueId, string productId, int quantityIssue, int price, int total, string departmentId, string productName)
        {
            //DateTime date = DateTime.Now;
            var date = DateTime.Now.Date;
            var issueDetail = new IssueDetail()
            {
                IssueID = issueId,
                ProductID = productId,
                Quantity = quantityIssue,
                Price = price,
                Active = true,
                CreatedDate = date,
                DepartmentID = departmentId,
                Total = total,
            };

            try
            {
                _issueDetailService.Add(issueDetail);
                try
                {
                    _weekReportService.InsertOrUpdateWeekReport(departmentId, productName, date, quantityIssue);
                }
                catch (SqlException ex)
                {
                    messageError.InnerText = ex.Message;
                }
                catch (Exception ex)
                {
                    messageError.InnerText = ex.Message;
                }

            }
            catch (SqlException ex)
            {
                messageError.InnerText = ex.Message;
            }
            catch (Exception ex)
            {
                messageError.InnerText = ex.Message;
            }
        }
Пример #3
0
 /// <summary>
 /// Thêm mới
 /// </summary>
 /// <param name="issueDetail"></param>
 /// <returns></returns>
 public void Add(IssueDetail issueDetail)
 {
     _context.IssueDetails.Add(issueDetail);
     SaveChanges();
 }
Пример #4
0
        /// <summary>
        /// Thêm Hóa đơn nhập chi tiết
        /// </summary>
        /// <param name="issueId">Mã hóa đơn nhập</param>
        /// <param name="productId">Mã mặt hàng</param>
        /// <param name="quantity">Số lượng nhập</param>
        /// <param name="price">Thành tiền</param>
        /// <param name="total"></param>
        /// <param name="departmentId"></param>
        private void InsertIssueDetails(string issueId, string productId, int quantity, int price, int total, string departmentId)
        {
            //DateTime date = DateTime.Now;
            var date = DateTime.Parse(txtReceiptDate.Text);
            var issueDetail = new IssueDetail()
            {
                IssueID = issueId,
                ProductID = productId,
                Quantity = quantity,
                Price = price,
                Active = true,
                CreatedDate = date,
                DepartmentID = departmentId,
                Total = total,
            };

            try
            {
                _issueDetailService.Add(issueDetail);
                try
                {
                    _weekReportService.InsertOrUpdateWeekReport(departmentId, gridLookUpEditDepartment.Text, date, quantity);
                }
                catch (SqlException ex)
                {
                    MessageBoxHelper.ShowMessageBoxError(ex.Message);
                }
                catch (Exception ex)
                {
                    MessageBoxHelper.ShowMessageBoxError(ex.Message);
                }
                
            }
            catch (SqlException ex)
            {
                MessageBoxHelper.ShowMessageBoxError(ex.Message);
            }
            catch (Exception ex)
            {
                MessageBoxHelper.ShowMessageBoxError(ex.Message);
            }
        }