Пример #1
0
        private void save()
        {
            DECatagory catagory = new DECatagory();

            AssignData(catagory);

            BLLCatagory obj_BLLCatagory = new BLLCatagory();

            try
            {
                int int_Result = obj_BLLCatagory.InsertData(catagory);

                if (int_Result > 0)
                {
                    MessageBox.Show(UIConstantMessage.Const_strSaveSuccessfully);
                    BindDataGridView();
                    clearScreen();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                catagory        = null;
                obj_BLLCatagory = null;
            }
        }
Пример #2
0
        private void search()
        {
            DateTime dateTime_From = Convert.ToDateTime(dtp_InvoiceDateFrom.Value);
            DateTime dateTime_To   = Convert.ToDateTime(dtp_InvoiceDateTo.Value.Date.AddHours(23.9));

            DECatagory category = new DECatagory();

            BLLInvoiceDetail       obj_BLLInvoiceDetail       = new BLLInvoiceDetail();
            BLLInvoiceReturnDetail obj_BLLInvoiceReturnDetail = new BLLInvoiceReturnDetail();

            try
            {
                category.Catagory_Id = Convert.ToInt32(cbx_Category.SelectedItem.Col3);
            }
            catch (Exception ex)
            {
                category.Catagory_Id = 0;
            }

            DataTable dt_Sale = obj_BLLInvoiceDetail.LoadProductSaleSummaryTableForAllDataByInvoiceDate(dateTime_From, dateTime_To, category.Catagory_Id);

            DataTable dt_Return = obj_BLLInvoiceReturnDetail.LoadProductReturnSummaryTableForAllDataByInvoiceDate(dateTime_From, dateTime_To, category.Catagory_Id);

            if (rdo_Sale.Checked == true)
            {
                bindSaleSummaryReport(dt_Sale);
            }
            else if (rdo_Return.Checked == true)
            {
                bindReturnSummaryReport(dt_Return);
            }
        }
Пример #3
0
        public DataTable LoadCatagoryTableForAllDataByCatagoryDescription(DECatagory catagory)
        {
            DALCatagory obj_DALCatagory = new DALCatagory();

            DataTable dt_Catagory = obj_DALCatagory.LoadCatagoryTableForAllDataByCatagoryDescription(catagory);

            obj_DALCatagory = null;

            return(dt_Catagory);
        }
Пример #4
0
        public int DeleteData(DECatagory catagory)
        {
            DALCatagory obj_DALCatagory = new DALCatagory();

            int int_Result = obj_DALCatagory.DeleteData(catagory);

            obj_DALCatagory = null;

            return(int_Result);
        }
Пример #5
0
        private SqlCommand DeclareSqlCmdParameter(SqlCommand SqlCmd, DECatagory catagory)
        {
            SqlCmd.Parameters.AddWithValue("@Catagory_Id", catagory.Catagory_Id);
            SqlCmd.Parameters.AddWithValue("@Catagory_Description", catagory.Catagory_Description);
            SqlCmd.Parameters.AddWithValue("@Active", catagory.Active);
            SqlCmd.Parameters.AddWithValue("@ModifiedBy", catagory.ModifiedBy);
            SqlCmd.Parameters.AddWithValue("@ModifiedDate", catagory.ModifiedDate);

            return(SqlCmd);
        }
Пример #6
0
        public Boolean LoadCatagoryRow(DECatagory catagory)
        {
            DALCatagory obj_DALCatagory = new DALCatagory();

            Boolean bool_HasRows = obj_DALCatagory.LoadCatagoryRow(catagory);

            obj_DALCatagory = null;

            return(bool_HasRows);
        }
Пример #7
0
        public int UpdateData(DECatagory catagory)
        {
            int int_Result;

            SqlCommand sqlCmd = new SqlCommand();

            sqlCmd.CommandText = "UPDATE tbl_Catagory SET Catagory_Id= @Catagory_Id, Catagory_Description=@Catagory_Description, Active = @Active ,ModifiedBy = @ModifiedBy ,ModifiedDate = @ModifiedDate WHERE Catagory_Id = @Catagory_Id";

            DeclareSqlCmdParameter(sqlCmd, catagory);

            int_Result = SqlConjunction.GetSQLVoid(sqlCmd);

            sqlCmd = null;

            return(int_Result);
        }
Пример #8
0
        public int InsertData(DECatagory catagory)
        {
            int int_Result;

            SqlCommand sqlCmd = new SqlCommand();

            sqlCmd.CommandText = "SELECT @Catagory_Id = ISNULL(MAX(Catagory_Id),0)+1 FROM tbl_Catagory INSERT  tbl_Catagory  VALUES(@Catagory_Id,@Catagory_Description,@Active,@ModifiedBy,@ModifiedDate)";

            DeclareSqlCmdParameter(sqlCmd, catagory);

            int_Result = SqlConjunction.GetSQLVoid(sqlCmd);

            sqlCmd = null;

            return(int_Result);
        }
Пример #9
0
        public int DeleteData(DECatagory catagory)
        {
            int int_Result;

            SqlCommand sqlCmd = new SqlCommand();

            sqlCmd.CommandText = "DELETE FROM tbl_Catagory  WHERE Catagory_ID = @Catagory_Id";

            DeclareSqlCmdParameter(sqlCmd, catagory);

            int_Result = SqlConjunction.GetSQLVoid(sqlCmd);

            sqlCmd = null;

            return(int_Result);
        }
Пример #10
0
        public DataTable LoadCatagoryTableForAllDataByCatagoryDescription(DECatagory catagory)
        {
            DataTable dt_Catagory;

            SqlCommand sqlCmd = new SqlCommand();

            sqlCmd.CommandText = "SELECT 0 As 'No',Cat.Catagory_Id,Cat.Catagory_Description,Cat.Active,Cat.ModifiedBy,Cat.ModifiedDate FROM tbl_Catagory Cat where Cat.Active = 'true' And	Cat.Catagory_Description  LIKE '%' + @Catagory_Description+ '%' order by Cat.Catagory_Description";

            sqlCmd = DeclareSqlCmdParameter(sqlCmd, catagory);

            dt_Catagory = SqlConjunction.GetSQLDataTable(sqlCmd);

            sqlCmd = null;

            return(dt_Catagory);
        }
Пример #11
0
        public int InsertData(DECatagory catagory)
        {
            DALCatagory obj_DALCatagory = new DALCatagory();

            int int_Result;

            if (catagory.Catagory_Id == 0)
            {
                int_Result = obj_DALCatagory.InsertData(catagory);
            }
            else
            {
                int_Result = obj_DALCatagory.UpdateData(catagory);
            }

            obj_DALCatagory = null;

            return(int_Result);
        }
Пример #12
0
        private void dgv_Catagory_DoubleClick(object sender, EventArgs e)
        {
            DECatagory catagory = new DECatagory();

            catagory.Catagory_Id = Convert.ToInt32(dgv_Catagory.CurrentRow.Cells[1].Value);

            BLLCatagory obj_BLLCatagory = new BLLCatagory();
            bool        bool_Result     = obj_BLLCatagory.LoadCatagoryRow(catagory);

            if (bool_Result == true)
            {
                DisplayData(catagory);
            }
            else
            {
                MessageBox.Show("Record is not found.");
            }

            catagory        = null;
            obj_BLLCatagory = null;
        }
Пример #13
0
        public Boolean LoadCatagoryRow(DECatagory catagory)
        {
            Boolean bool_HasRows = false;

            SqlCommand sqlCmd = new SqlCommand();

            sqlCmd.CommandText = "SELECT Catagory_Id,Catagory_Description,Active,ModifiedBy,ModifiedDate FROM tbl_Catagory Where Catagory_Id=@Catagory_Id";

            sqlCmd = DeclareSqlCmdParameter(sqlCmd, catagory);

            SqlConnection con = new SqlConnection(SqlConjunction.DataConn);

            SqlDataReader sqlDataReader = SqlConjunction.GetSQLExecuteReader(sqlCmd, con);

            while (sqlDataReader.Read())
            {
                catagory.Catagory_Id          = sqlDataReader.GetInt32(0);
                catagory.Catagory_Description = sqlDataReader.GetString(1);
                catagory.Active       = sqlDataReader.GetBoolean(2);
                catagory.ModifiedBy   = sqlDataReader.GetString(3);
                catagory.ModifiedDate = sqlDataReader.GetDateTime(4);
            }

            if (sqlDataReader.HasRows)
            {
                bool_HasRows = true;
            }
            else
            {
                bool_HasRows = false;
            }
            con.Close();

            sqlCmd = null;

            return(bool_HasRows);
        }
Пример #14
0
        private void BindDataGridView()
        {
            DECatagory catagory = new DECatagory();

            BLLCatagory obj_BLLCatagory = new BLLCatagory();

            DataTable dt_Catagory;

            if (txt_FilteredDescription.Text.Trim().Length <= 0)
            {
                dt_Catagory = obj_BLLCatagory.LoadCatagoryTableForAllData();
            }
            else
            {
                catagory.Catagory_Description = txt_FilteredDescription.Text;
                dt_Catagory = obj_BLLCatagory.LoadCatagoryTableForAllDataByCatagoryDescription(catagory);
            }

            dgv_Catagory.DataSource = dt_Catagory;

            NumberingTableForDataGridView(dt_Catagory);

            FormatDataGridView();
        }
Пример #15
0
 private void AssignData(DECatagory catagory)
 {
     catagory.Catagory_Id          = Convert.ToInt32(txt_CatagoryDescription.Tag);
     catagory.Catagory_Description = txt_CatagoryDescription.Text.Trim();
     catagory.ModifiedBy           = DEGlobal.str_UserName;
 }
Пример #16
0
 private void DisplayData(DECatagory catagory)
 {
     txt_CatagoryDescription.Tag  = catagory.Catagory_Id;
     txt_CatagoryDescription.Text = catagory.Catagory_Description;
 }
        private void search()
        {
            if (false) //(cbx_Customer.Text.Trim().Length == 0 || cbx_Customer.SelectedValue == null)
            {
                ErrorProvider.SetError(cbx_Customer, "Please Select Customer");
                string str_error = ErrorProvider.GetError(cbx_Customer);
                MessageBox.Show(str_error);

                ErrorProvider.Clear();
            }
            else
            {
                BLLInvoice obj_BLLInvoice = new BLLInvoice();

                DECustomer customer = new DECustomer();
                DEInvoice  invoice  = new DEInvoice();

                DECatagory category = new DECatagory();

                DateTime dateTime_From = Convert.ToDateTime(dtp_InvoiceDateFrom.Value);
                DateTime dateTime_To   = Convert.ToDateTime(dtp_InvoiceDateTo.Value.Date.AddHours(23.9));

                try
                {
                    customer.Catagory_Id          = Convert.ToInt32(cbx_CustomerGroup.SelectedItem.Col3);
                    customer.Catagory_Description = cbx_CustomerGroup.SelectedText;
                }
                catch (Exception ex)
                {
                    customer.Catagory_Id          = 0;
                    customer.Customer_Description = "";
                }

                try
                {
                    customer.Customer_Id = Convert.ToInt32(cbx_Customer.SelectedItem.Col4);
                }
                catch (Exception ex)
                {
                    customer.Customer_Id = 0;
                }

                try
                {
                    category.Catagory_Id = Convert.ToInt32(cbx_Category.SelectedItem.Col3);
                }
                catch (Exception ex)
                {
                    category.Catagory_Id = 0;
                }

                invoice.Customer_Id           = customer.Customer_Id;
                customer.Customer_Description = cbx_Customer.Text;
                customer.Address = txt_Address.Text;
                customer.Phone   = txt_PhoneNo.Text;

                DataTable dt_Sale   = new DataTable();
                DataTable dt_Return = new DataTable();

                if (rdo_Customer.Checked)
                {
                    dt_Sale   = obj_BLLInvoice.LoadInvoiceDetailTableForAllDataByInvoiceDateCustomerId(invoice.Customer_Id, dateTime_From, dateTime_To, category.Catagory_Id);
                    dt_Return = obj_BLLInvoice.LoadProductReturnSummaryTableForAllDataByInvoiceDateCustomerId(invoice.Customer_Id, dateTime_From, dateTime_To, category.Catagory_Id);
                }
                else
                {
                    dt_Sale   = obj_BLLInvoice.LoadInvoiceDetailTableForAllDataByInvoiceDateCustomerGroupId(customer.Catagory_Id, dateTime_From, dateTime_To, category.Catagory_Id);
                    dt_Return = obj_BLLInvoice.LoadProductReturnSummaryTableForAllDataByInvoiceDateCustomerId(customer.Catagory_Id, dateTime_From, dateTime_To, category.Catagory_Id);
                }

                if (rdo_Sale.Checked == true)
                {
                    bindSaleReport(customer, dt_Sale);
                }
                else
                {
                    bindReturnReport(customer, dt_Return);
                }
            }
        }