コード例 #1
0
 public void Delete(SqlTransaction objSqlTransaction, PurchaseOrderEL objPurchasesOrderEL)
 {
     SQLHelper objSQLHelper = new SQLHelper();
     int       cpmpanyId    = objSQLHelper.ExecuteDeleteProcedure("DeletePurchasesOrder", objSqlTransaction
                                                                  , objSQLHelper.SqlParam("@Purchases_Order_Id", objPurchasesOrderEL.Purchases_Order_Id, SqlDbType.Int)
                                                                  );
 }
コード例 #2
0
        public List <PurchaseOrderEL> GetPurchasesOrderByBillId(int BillId)
        {
            PurchaseOrderEL        objPurchasesOrderEL;
            List <PurchaseOrderEL> lstPurchasesOrder = new List <PurchaseOrderEL>();

            SQLHelper objSQLHelper = new SQLHelper();
            DataTable dt           = objSQLHelper.ExecuteSelectProcedure("GetPurchasesOrderByBillId"
                                                                         , objSQLHelper.SqlParam("@Bill_Id", BillId, SqlDbType.Int)
                                                                         );

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    objPurchasesOrderEL                    = new PurchaseOrderEL();
                    objPurchasesOrderEL.Company_id         = Convert.ToInt32(dt.Rows[i]["Company_id"]);
                    objPurchasesOrderEL.Date               = Convert.ToDateTime(dt.Rows[i]["Date"]);
                    objPurchasesOrderEL.Purchases_Order_Id = Convert.ToInt32(dt.Rows[i]["Purchases_Order_Id"]);
                    objPurchasesOrderEL.Purchases_Order_No = dt.Rows[i]["Purchases_Order_No"].ToString();
                    objPurchasesOrderEL.Tax_Percentage     = Convert.ToDecimal(dt.Rows[i]["Tax_Percentage"]);
                    objPurchasesOrderEL.Other_Amount       = Convert.ToDecimal(dt.Rows[i]["Other_Amount"]);
                    objPurchasesOrderEL.Requisitioner      = dt.Rows[i]["Requisitioner"].ToString();
                    objPurchasesOrderEL.Credit_Term        = dt.Rows[i]["Credit_Term"].ToString();
                    objPurchasesOrderEL.Shipping_Term      = dt.Rows[i]["Shipping_Term"].ToString();
                    objPurchasesOrderEL.Comments           = dt.Rows[i]["Comments"].ToString();
                    lstPurchasesOrder.Add(objPurchasesOrderEL);
                }
            }
            return(lstPurchasesOrder);
        }
コード例 #3
0
 public void Update(SqlTransaction objSqlTransaction, PurchaseOrderEL objPurchasesOrderEL)
 {
     SQLHelper objSQLHelper = new SQLHelper();
     int       Id           = objSQLHelper.ExecuteUpdateProcedure("UpdatePurchasesOrder", objSqlTransaction
                                                                  , objSQLHelper.SqlParam("@Date", objPurchasesOrderEL.Date, SqlDbType.DateTime)
                                                                  , objSQLHelper.SqlParam("@Purchases_Order_No", objPurchasesOrderEL.Purchases_Order_No, SqlDbType.NVarChar)
                                                                  , objSQLHelper.SqlParam("@Purchases_Order_Id", objPurchasesOrderEL.Purchases_Order_Id, SqlDbType.Int)
                                                                  );
 }
コード例 #4
0
        //public List<PurchaseOrderEL> GetPurchaseOrder()
        //{
        //    PurchaseOrderEL objPurchaseOrderEL;
        //    List<PurchaseOrderEL> lstPurchaseOrderEL = new List<PurchaseOrderEL>();

        //    SQLHelper objSQLHelper = new SQLHelper();
        //    DataTable dt = objSQLHelper.ExecuteSelectProcedure("SelectPurchasesOrderAll");

        //    if (dt != null)
        //    {
        //        for (int i = 0; i < dt.Rows.Count; i++)
        //        {
        //            objPurchaseOrderEL = new PurchaseOrderEL();
        //            objPurchaseOrderEL.Company_id = (int)dt.Rows[i]["Company_id"];
        //            objPurchaseOrderEL.Date = Convert.ToDateTime(dt.Rows[i]["Date"]);
        //            objPurchaseOrderEL.Purchases_Order_Id = (int)dt.Rows[i]["Purchases_Order_Id"];
        //            objPurchaseOrderEL.Purchases_Order_No = dt.Rows[i]["Purchases_Order_No"].ToString();
        //            lstPurchaseOrderEL.Add(objPurchaseOrderEL);
        //        }
        //    }
        //    return lstPurchaseOrderEL;
        //}

        public int Insert(SqlTransaction objSqlTransaction, PurchaseOrderEL objPurchasesOrderEL)
        {
            SQLHelper objSQLHelper = new SQLHelper();
            int       Id           = objSQLHelper.ExecuteInsertProcedure("InsertPurchasesOrder", objSqlTransaction
                                                                         , objSQLHelper.SqlParam("@Company_id", objPurchasesOrderEL.Company_id, SqlDbType.Int)
                                                                         , objSQLHelper.SqlParam("@Date", objPurchasesOrderEL.Date, SqlDbType.DateTime)
                                                                         , objSQLHelper.SqlParam("@Purchases_Order_No", objPurchasesOrderEL.Purchases_Order_No, SqlDbType.NVarChar)
                                                                         );

            return(Id);
        }
コード例 #5
0
        public PurchasesDetailReport(CompanyEL _objCompanyEL, PurchaseOrderEL _PurchaseOrderEL)
            : this()
        {
            this.companyEL     = _objCompanyEL;
            objPurchaseOrderEL = _PurchaseOrderEL;

            lblCompanyName.Text      = companyEL.company_name;
            lblPurchasesOrderNo.Text = "Purchases Order No  " + objPurchaseOrderEL.Purchases_Order_No;
            GetGlobalVariableData();
            ItemGridBind();
        }
コード例 #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (textPuchasesOrderNo.Text.Trim() == "")
            {
                Common.MessageAlert("First enter Purchases Order No");
                return;
            }
            if (dataGridView1.Rows.Count - 1 <= 0)
            {
                Common.MessageAlert("First Enter Item Detail");
                return;
            }

            SQLHelper      objSQLHelper      = new SQLHelper();
            SqlTransaction objSqlTransaction = objSQLHelper.BeginTrans();

            try
            {
                PurchaseOrderEL               objPurchaseOrderEL  = new PurchaseOrderEL();
                PurchaseOrderDL               objPurchasesOrderDL = new PurchaseOrderDL();
                PurchasesOrderDetailEL        objPurchasesOrderDetailEL;
                List <PurchasesOrderDetailEL> lstPurchasesOrderDetailEL = new List <PurchasesOrderDetailEL>();
                PurchasesOrderDetailDL        objPurchasesOrderDetailDL = new PurchasesOrderDetailDL();

                objPurchaseOrderEL.Company_id         = companyEL.Company_id;
                objPurchaseOrderEL.Date               = dateTimePickerPurchasesOrderDate.Value;
                objPurchaseOrderEL.Purchases_Order_No = textPuchasesOrderNo.Text.Trim();
                int PurchaseOrderId = objPurchasesOrderDL.Insert(objSqlTransaction, objPurchaseOrderEL);


                for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                {
                    objPurchasesOrderDetailEL = new PurchasesOrderDetailEL();
                    //objPurchasesOrderDetailEL.Item_Name = dataGridView1.Rows[i].Cells["Item_Name"].Value.ToString().Trim();
                    objPurchasesOrderDetailEL.Item_id            = Convert.ToInt32(dataGridView1.Rows[i].Cells["ItemName"].Value);
                    objPurchasesOrderDetailEL.Item_Quantity      = Convert.ToDouble(dataGridView1.Rows[i].Cells["Item_Quantity"].Value);
                    objPurchasesOrderDetailEL.Item_Rate          = Convert.ToDouble(dataGridView1.Rows[i].Cells["Item_Rate"].Value);
                    objPurchasesOrderDetailEL.Purchases_Order_Id = PurchaseOrderId;
                    lstPurchasesOrderDetailEL.Add(objPurchasesOrderDetailEL);
                }

                lstPurchasesOrderDetailEL.ForEach(r => objPurchasesOrderDetailDL.Insert(objSqlTransaction, r));

                objSqlTransaction.Commit();
                Common.MessageSave();
                FillListBox();
                ControlClear();
            }
            catch
            {
                objSqlTransaction.Rollback();
                Common.MessageAlert("First enter data in correct format");
            }
        }
コード例 #7
0
        public void Delete(PurchaseOrderEL objPurchasesOrderEL)
        {
            SQLHelper      objSQLHelper      = new SQLHelper();
            SqlTransaction objSqlTransaction = objSQLHelper.BeginTrans();

            try
            {
                Delete(objSqlTransaction, objPurchasesOrderEL);
                objSqlTransaction.Commit();
            }
            catch
            {
                objSqlTransaction.Rollback();
            }
        }
コード例 #8
0
        public void Update(SqlTransaction objSqlTransaction, PurchaseOrderEL objPurchasesOrderEL)
        {
            SQLHelper objSQLHelper = new SQLHelper();
            int       Id           = objSQLHelper.ExecuteUpdateProcedure("UpdatePurchasesOrder", objSqlTransaction
                                                                         , objSQLHelper.SqlParam("@Date", objPurchasesOrderEL.Date, SqlDbType.DateTime)
                                                                         , objSQLHelper.SqlParam("@Purchases_Order_No", objPurchasesOrderEL.Purchases_Order_No, SqlDbType.NVarChar)
                                                                         , objSQLHelper.SqlParam("@Purchases_Order_Id", objPurchasesOrderEL.Purchases_Order_Id, SqlDbType.Int)
                                                                         , objSQLHelper.SqlParam("@Tax_Percentage", objPurchasesOrderEL.Tax_Percentage, SqlDbType.Decimal)
                                                                         , objSQLHelper.SqlParam("@Other_Amount ", objPurchasesOrderEL.Other_Amount, SqlDbType.Decimal)
                                                                         , objSQLHelper.SqlParam("@Requisitioner ", objPurchasesOrderEL.Requisitioner, SqlDbType.NVarChar)
                                                                         , objSQLHelper.SqlParam("@Credit_Term ", objPurchasesOrderEL.Credit_Term, SqlDbType.NVarChar)
                                                                         , objSQLHelper.SqlParam("@Shipping_Term ", objPurchasesOrderEL.Shipping_Term, SqlDbType.NVarChar)
                                                                         , objSQLHelper.SqlParam("@Comments", objPurchasesOrderEL.Comments, SqlDbType.NVarChar)

                                                                         );
        }
コード例 #9
0
        public PurchaseOrderEL GetPurchasesOrderById(int purchasesOrderId)
        {
            PurchaseOrderEL objPurchasesOrderEL = new PurchaseOrderEL();
            SQLHelper       objSQLHelper        = new SQLHelper();
            DataTable       dt = objSQLHelper.ExecuteSelectProcedure("SelectPurchasesOrderById"
                                                                     , objSQLHelper.SqlParam("@Purchases_Order_Id", purchasesOrderId, SqlDbType.Int)
                                                                     );

            if (dt != null && dt.Rows.Count > 0)
            {
                objPurchasesOrderEL.Company_id         = (int)dt.Rows[0]["Company_id"];
                objPurchasesOrderEL.Purchases_Order_No = dt.Rows[0]["Purchases_Order_No"].ToString();
                objPurchasesOrderEL.Date = Convert.ToDateTime(dt.Rows[0]["Date"]);
            }

            return(objPurchasesOrderEL);
        }
コード例 #10
0
        public int Insert(PurchaseOrderEL objPurchasesOrderEL)
        {
            SQLHelper      objSQLHelper      = new SQLHelper();
            SqlTransaction objSqlTransaction = objSQLHelper.BeginTrans();

            try
            {
                int Id = Insert(objSqlTransaction, objPurchasesOrderEL);
                objSqlTransaction.Commit();
                return(Id);
            }
            catch (Exception)
            {
                objSqlTransaction.Rollback();
                throw;
            }
        }
コード例 #11
0
        private void ListPurchaseOrder_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex == 4)
                {
                    PurchaseOrderEL objPurchaseOrderEL = new PurchaseOrderEL();
                    objPurchaseOrderEL.Purchases_Order_Id = Convert.ToInt32(ListPurchaseOrder.SelectedRows[0].Cells["Purchases_Order_Id"].Value);
                    objPurchaseOrderEL.Purchases_Order_No = ListPurchaseOrder.SelectedRows[0].Cells["Purchases_Order_No"].Value.ToString();

                    PurchasesDetailReport objPurchasesDetailReport = new PurchasesDetailReport(companyEL, objPurchaseOrderEL);
                    objPurchasesDetailReport.ShowDialog();
                }
            }
            catch
            {
            }
        }
コード例 #12
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            try
            {
                PurchaseOrderEL objPurchaseOrderEL = new PurchaseOrderEL();
                objPurchaseOrderEL.Purchases_Order_Id = Convert.ToInt32(ListPurchaseOrder.SelectedRows[0].Cells["Purchases_Order_Id"].Value);
                objPurchaseOrderEL.Purchases_Order_No = Convert.ToString(ListPurchaseOrder.SelectedRows[0].Cells["Purchases_Order_No"].Value);

                DeliveryOrder objDeliveryOrder = new DeliveryOrder(companyEL, objPurchaseOrderEL);
                objDeliveryOrder.MdiParent   = this.MdiParent;
                objDeliveryOrder.WindowState = FormWindowState.Maximized;
                objDeliveryOrder.Show();
                this.Dispose();
            }
            catch
            {
            }
        }
コード例 #13
0
        public DeliveryOrder(CompanyEL _companyEL, PurchaseOrderEL _purchaseOrderEL)
            : this()
        {
            companyEL       = _companyEL;
            purchaseOrderEL = _purchaseOrderEL;

            lbCompanyName.Text      = companyEL.company_name;
            lbPurchasesOrderNo.Text = purchaseOrderEL.Purchases_Order_No;
            FillListBox();

            if (Billing.Properties.Settings.Default.Challan_No_Mannual == 1)
            {
                textDeliveryOrderNo.ReadOnly = false;
            }
            else
            {
                textDeliveryOrderNo.ReadOnly = true;
            }
        }
コード例 #14
0
        private void Export(bool isExcel)
        {
            CompanyEL       companyEL      = SelectedCompany;
            PurchaseOrderEL purchasesOrder = SelectedPurchasesOrder;
            string          filePath       = @"\ExlPurchasesOrder.xlsx";

            Common objCommon = new Common();

            objCommon.PurchasesOrderExcelExport(dataGridView1
                                                , saveFileDialog1
                                                , filePath
                                                , SelectedPurchasesOrder.Purchases_Order_No
                                                , SelectedPurchasesOrder.Date.ToString("MMMM, dd yyyy")
                                                , SelectedCompany.company_name
                                                , SelectedCompany.address1
                                                , SelectedCompany.city
                                                , SelectedCompany.state
                                                , SelectedCompany.pincode
                                                , isExcel);
        }
コード例 #15
0
        public PurchaseOrderEL GetPurchasesOrderById(int purchasesOrderId)
        {
            PurchaseOrderEL objPurchasesOrderEL = new PurchaseOrderEL();
            SQLHelper       objSQLHelper        = new SQLHelper();
            DataTable       dt = objSQLHelper.ExecuteSelectProcedure("SelectPurchasesOrderById"
                                                                     , objSQLHelper.SqlParam("@Purchases_Order_Id", purchasesOrderId, SqlDbType.Int)
                                                                     );

            if (dt != null && dt.Rows.Count > 0)
            {
                objPurchasesOrderEL.Company_id         = (int)dt.Rows[0]["Company_id"];
                objPurchasesOrderEL.Purchases_Order_No = dt.Rows[0]["Purchases_Order_No"].ToString();
                objPurchasesOrderEL.Date           = Convert.ToDateTime(dt.Rows[0]["Date"]);
                objPurchasesOrderEL.Tax_Percentage = Convert.ToDecimal(dt.Rows[0]["Tax_Percentage"]);
                objPurchasesOrderEL.Other_Amount   = Convert.ToDecimal(dt.Rows[0]["Other_Amount"]);
                objPurchasesOrderEL.Requisitioner  = dt.Rows[0]["Requisitioner"].ToString();
                objPurchasesOrderEL.Credit_Term    = dt.Rows[0]["Credit_Term"].ToString();
                objPurchasesOrderEL.Shipping_Term  = dt.Rows[0]["Shipping_Term"].ToString();
                objPurchasesOrderEL.Comments       = dt.Rows[0]["Comments"].ToString();
            }

            return(objPurchasesOrderEL);
        }
コード例 #16
0
        public List <PurchaseOrderEL> GetPurchasesOrderByBillId(int BillId)
        {
            PurchaseOrderEL        objPurchasesOrderEL;
            List <PurchaseOrderEL> lstPurchasesOrder = new List <PurchaseOrderEL>();

            SQLHelper objSQLHelper = new SQLHelper();
            DataTable dt           = objSQLHelper.ExecuteSelectProcedure("GetPurchasesOrderByBillId"
                                                                         , objSQLHelper.SqlParam("@Bill_Id", BillId, SqlDbType.Int)
                                                                         );

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    objPurchasesOrderEL                    = new PurchaseOrderEL();
                    objPurchasesOrderEL.Company_id         = Convert.ToInt32(dt.Rows[i]["Company_id"]);
                    objPurchasesOrderEL.Date               = Convert.ToDateTime(dt.Rows[i]["Date"]);
                    objPurchasesOrderEL.Purchases_Order_Id = Convert.ToInt32(dt.Rows[i]["Purchases_Order_Id"]);
                    objPurchasesOrderEL.Purchases_Order_No = dt.Rows[i]["Purchases_Order_No"].ToString();
                    lstPurchasesOrder.Add(objPurchasesOrderEL);
                }
            }
            return(lstPurchasesOrder);
        }
コード例 #17
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //if ((string.IsNullOrEmpty( textPuchasesOrderNo.Text.Trim())))
            //{
            //    Common.MessageAlert("First enter Purchases Order No");
            //    return;
            //}
            decimal result;

            if (string.IsNullOrEmpty(textTax.Text.Trim()) || !decimal.TryParse(textTax.Text, out result))
            {
                Common.MessageAlert("First enter Tax Percentage");
                return;
            }
            if (dataGridView1.Rows.Count - 1 <= 0)
            {
                Common.MessageAlert("First Enter Item Detail");
                return;
            }

            SQLHelper      objSQLHelper      = new SQLHelper();
            SqlTransaction objSqlTransaction = objSQLHelper.BeginTrans();

            try
            {
                PurchaseOrderEL               objPurchaseOrderEL  = new PurchaseOrderEL();
                PurchaseOrderDL               objPurchasesOrderDL = new PurchaseOrderDL();
                PurchasesOrderDetailEL        objPurchasesOrderDetailEL;
                List <PurchasesOrderDetailEL> lstPurchasesOrderDetailEL = new List <PurchasesOrderDetailEL>();
                PurchasesOrderDetailDL        objPurchasesOrderDetailDL = new PurchasesOrderDetailDL();

                objPurchaseOrderEL.Company_id     = SelectedCompany.Company_id;
                objPurchaseOrderEL.Date           = dateTimePickerPurchasesOrderDate.Value;
                objPurchaseOrderEL.Tax_Percentage = Convert.ToDecimal(textTax.Text);

                if (string.IsNullOrEmpty(txtOtherAmount.Text.Trim()))
                {
                    objPurchaseOrderEL.Other_Amount = 0;
                }
                else
                {
                    objPurchaseOrderEL.Other_Amount = Convert.ToDecimal(txtOtherAmount.Text);
                }



                objPurchaseOrderEL.Requisitioner      = txtRequisitioner.Text;
                objPurchaseOrderEL.Credit_Term        = txtCreditTerm.Text;
                objPurchaseOrderEL.Shipping_Term      = txtShippingTerm.Text;
                objPurchaseOrderEL.Comments           = txtComments.Text;
                objPurchaseOrderEL.Purchases_Order_No = textPuchasesOrderNo.Text.Trim();
                int PurchaseOrderId = objPurchasesOrderDL.Insert(objSqlTransaction, objPurchaseOrderEL);


                for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                {
                    objPurchasesOrderDetailEL = new PurchasesOrderDetailEL();
                    //objPurchasesOrderDetailEL.Item_Name = dataGridView1.Rows[i].Cells["Item_Name"].Value.ToString().Trim();
                    objPurchasesOrderDetailEL.Item_id            = Convert.ToInt32(dataGridView1.Rows[i].Cells["ItemName"].Value);
                    objPurchasesOrderDetailEL.Item_Quantity      = Convert.ToDouble(dataGridView1.Rows[i].Cells["Item_Quantity"].Value);
                    objPurchasesOrderDetailEL.Item_Rate          = Convert.ToDouble(dataGridView1.Rows[i].Cells["Item_Rate"].Value);
                    objPurchasesOrderDetailEL.Item_Unit          = dataGridView1.Rows[i].Cells["Item_Unit"].Value.ToString();
                    objPurchasesOrderDetailEL.Purchases_Order_Id = PurchaseOrderId;
                    lstPurchasesOrderDetailEL.Add(objPurchasesOrderDetailEL);
                }

                lstPurchasesOrderDetailEL.ForEach(r => objPurchasesOrderDetailDL.Insert(objSqlTransaction, r));

                objSqlTransaction.Commit();
                Common.MessageSave();
                FillListBox();
                ControlClear();
            }
            catch
            {
                objSqlTransaction.Rollback();
                Common.MessageAlert("First enter data in correct format");
            }
        }