public static int adddamagedStockExpiry(damagedStockExpiry damagedStock)
 {
     try
     {
         int i = 0;
         i = damagedStockExpiryProvider.adddamagedStockExpiry(damagedStock);
         return(i);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
        public static int adddamagedStockExpiry(damagedStockExpiry damagedStock)
        {
            try
            {
                List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >();
                parameter.Add(new KeyValuePair <string, object>("@damagedStockExpiryId", damagedStock.damagedStockExpiryId));
                parameter.Add(new KeyValuePair <string, object>("@damagedStockDate", damagedStock.damagedStockDate));
                parameter.Add(new KeyValuePair <string, object>("@accountId", damagedStock.accountId));
                parameter.Add(new KeyValuePair <string, object>("@InvoiceId", damagedStock.InvoiceId));
                parameter.Add(new KeyValuePair <string, object>("@addedBy", damagedStock.addedBy));
                parameter.Add(new KeyValuePair <string, object>("@addedOn", damagedStock.addedOn));
                parameter.Add(new KeyValuePair <string, object>("@FinancialYearID", damagedStock.FinancialYearID));
                parameter.Add(new KeyValuePair <string, object>("@Amount", damagedStock.Amount));
                parameter.Add(new KeyValuePair <string, object>("@Remark", damagedStock.Remark));
                parameter.Add(new KeyValuePair <string, object>("@isUpdate", damagedStock.isUpdate));
                parameter.Add(new KeyValuePair <string, object>("@isDelete", damagedStock.isDelete));
                parameter.Add(new KeyValuePair <string, object>("@transactionId", damagedStock.transactionId));

                SqlHandler sqlH   = new SqlHandler();
                int        listi  = sqlH.ExecuteNonQueryI("[dbo].[Usp_adddamagedStockExpiry]", parameter);
                int        result = 0;
                for (int k = 0; k < damagedStock.dtItems.Rows.Count; k++)
                {
                    List <KeyValuePair <string, object> > parameter1 = new List <KeyValuePair <string, object> >();
                    parameter1.Add(new KeyValuePair <string, object>("@FinancialYearID", damagedStock.FinancialYearID));
                    parameter1.Add(new KeyValuePair <string, object>("@StockId", damagedStock.dtItems.Rows[k]["StockId"]));
                    parameter1.Add(new KeyValuePair <string, object>("@itemId", damagedStock.dtItems.Rows[k]["itemId"]));
                    parameter1.Add(new KeyValuePair <string, object>("@categoryId", damagedStock.dtItems.Rows[k]["categoryId"]));
                    parameter1.Add(new KeyValuePair <string, object>("@companyId", damagedStock.dtItems.Rows[k]["companyId"]));
                    parameter1.Add(new KeyValuePair <string, object>("@batchNo", damagedStock.dtItems.Rows[k]["batchNo"]));
                    parameter1.Add(new KeyValuePair <string, object>("@MFD_Date", damagedStock.dtItems.Rows[k]["MFD_Date"]));
                    parameter1.Add(new KeyValuePair <string, object>("@expireDate", damagedStock.dtItems.Rows[k]["expireDate"]));
                    parameter1.Add(new KeyValuePair <string, object>("@Quantity", damagedStock.dtItems.Rows[k]["Quantity"]));
                    parameter1.Add(new KeyValuePair <string, object>("@unitBy", damagedStock.dtItems.Rows[k]["unitBy"]));
                    parameter1.Add(new KeyValuePair <string, object>("@damagedStockExpiryItemId", damagedStock.dtItems.Rows[k]["damagedStockExpiryItemId"]));
                    parameter1.Add(new KeyValuePair <string, object>("@purchaseRate", damagedStock.dtItems.Rows[k]["purchaseRate"]));
                    parameter1.Add(new KeyValuePair <string, object>("@Amount", damagedStock.dtItems.Rows[k]["totalAmount"]));
                    //   parameter1.Add(new KeyValuePair<string, object>("@isUpdate", damagedStock.isUpdate));
                    parameter1.Add(new KeyValuePair <string, object>("@isDelete", damagedStock.isDelete));
                    parameter1.Add(new KeyValuePair <string, object>("@invoiceId", damagedStock.InvoiceId));
                    result = +sqlH.ExecuteNonQueryI("[dbo].[Usp_adddamagedStockExpiryItem]", parameter1);
                }
                return(listi + result);
            }
            catch (Exception ae)
            {
                throw ae;
            }//8999501263
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                for (int i = 0; i < dgvSaleItems.Rows.Count; i++)
                {
                    if (dgvSaleItems.Rows[i].Cells["itemName"].Value == null)
                    {
                        if (Utility.Langn == "English")
                        {
                            MessageBox.Show("Please add Item Name in list ...!");
                        }
                        else
                        {
                            MessageBox.Show("कृपया लिस्ट  मध्ये वस्तूचे नाव भरा..");
                        }
                        dgvSaleItems.Focus();
                        dgvSaleItems.CurrentCell = dgvSaleItems.Rows[i].Cells["itemName"];
                        return;
                    }
                    if (dgvSaleItems.Rows[i].Cells["Quantity"].Value == null)
                    {
                        if (Utility.Langn == "English")
                        {
                            MessageBox.Show("Please Add Quantity in list ...!");
                        }
                        else
                        {
                            MessageBox.Show("कृपया लिस्ट  मध्ये नग भरा..");
                        }
                        dgvSaleItems.Focus();
                        dgvSaleItems.CurrentCell = dgvSaleItems.Rows[i].Cells["Quantity"];
                        return;
                    }
                    if (dgvSaleItems.Rows[i].Cells["purchaseRate"].Value == null)
                    {
                        if (Utility.Langn == "English")
                        {
                            MessageBox.Show("Please add Rate in list ...!");
                        }
                        else
                        {
                            MessageBox.Show("कृपया लिस्ट  मध्ये दर भरा..");
                        }
                        dgvSaleItems.Focus();
                        dgvSaleItems.CurrentCell = dgvSaleItems.Rows[i].Cells["purchaseRate"];
                        return;
                    }
                }
                damagedStockExpiry sale        = new damagedStockExpiry();
                DataTable          dtSaleItems = new DataTable();


                foreach (DataGridViewColumn col in dgvSaleItems.Columns)
                {
                    dtSaleItems.Columns.Add(col.Name);
                }

                foreach (DataGridViewRow row in dgvSaleItems.Rows)
                {
                    DataRow dRow = dtSaleItems.NewRow();
                    foreach (DataGridViewCell cell in row.Cells)
                    {
                        if (cell.Value == null)
                        {
                            if (Utility.Langn == "English")
                            {
                                MessageBox.Show("Please Add all details in list");
                            }
                            else
                            {
                                MessageBox.Show("कृपया लिस्ट मध्ये पूर्ण माहिती भरा");
                            }
                            return;
                        }

                        dRow[cell.ColumnIndex] = cell.Value;
                    }
                    dtSaleItems.Rows.Add(dRow);
                }
                sale.dtItems          = dtSaleItems;
                sale.damagedStockDate = dtpChallenDate.Value;
                if (isUpdate == false)
                {
                    sale.damagedStockExpiryId = 0;
                    sale.InvoiceId            = SaleDetailsController.getMaxIdSalesItemDetails(7, Utility.FinancilaYearId);
                }
                else
                {
                    sale.damagedStockExpiryId = damagedStockExpiryId;
                    sale.InvoiceId            = Convert.ToInt64(txtInvoice.Text);
                }
                sale.transactionId   = transactionId;
                sale.Amount          = Utility.ParseValue(txtNetAmount.Text);
                sale.Remark          = txtNaration.Text;
                sale.addedBy         = Utility.LoginID;
                sale.accountId       = Convert.ToInt64(cmbAccountName.SelectedValue);
                sale.isDelete        = isDelete;
                sale.isUpdate        = isUpdate;
                sale.FinancialYearID = Utility.FinancilaYearId;
                sale.addedOn         = dtpChallenDate.Value;
                sale.transactionId   = 0;
                int s = damagedStockExpiryController.adddamagedStockExpiry(sale);
                if (s > 0)
                {
                    if (Utility.Langn == "English")
                    {
                        MessageBox.Show("This record saved successfully..!", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("सदर नोंद यशस्वीरित्या साठवले गेले आहे..!", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    btnnew_Click(sender, e);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }