Exemple #1
0
        private void save()
        {
            DECustomerCategory catagory = new DECustomerCategory();

            AssignData(catagory);

            BLLCustomerCategory obj_BLLCatagory = new BLLCustomerCategory();

            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;
            }
        }
Exemple #2
0
        private SqlCommand DeclareSqlCmdParameter(SqlCommand SqlCmd, DECustomerCategory 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);
        }
Exemple #3
0
        public DataTable LoadCatagoryTableForAllDataByCatagoryDescription(DECustomerCategory catagory)
        {
            DALCustomerCategory obj_DALCatagory = new DALCustomerCategory();

            DataTable dt_Catagory = obj_DALCatagory.LoadCatagoryTableForAllDataByCatagoryDescription(catagory);

            obj_DALCatagory = null;

            return(dt_Catagory);
        }
Exemple #4
0
        public int DeleteData(DECustomerCategory catagory)
        {
            DALCustomerCategory obj_DALCatagory = new DALCustomerCategory();

            int int_Result = obj_DALCatagory.DeleteData(catagory);

            obj_DALCatagory = null;

            return(int_Result);
        }
Exemple #5
0
        public Boolean LoadCatagoryRow(DECustomerCategory catagory)
        {
            DALCustomerCategory obj_DALCatagory = new DALCustomerCategory();

            Boolean bool_HasRows = obj_DALCatagory.LoadCatagoryRow(catagory);

            obj_DALCatagory = null;

            return(bool_HasRows);
        }
Exemple #6
0
        public int UpdateData(DECustomerCategory catagory)
        {
            int int_Result;

            SqlCommand sqlCmd = new SqlCommand();

            sqlCmd.CommandText = "UPDATE tbl_CustomerCatagory 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);
        }
Exemple #7
0
        public int InsertData(DECustomerCategory catagory)
        {
            int int_Result;

            SqlCommand sqlCmd = new SqlCommand();

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

            DeclareSqlCmdParameter(sqlCmd, catagory);

            int_Result = SqlConjunction.GetSQLVoid(sqlCmd);

            sqlCmd = null;

            return(int_Result);
        }
Exemple #8
0
        public DataTable LoadCatagoryTableForAllDataByCatagoryDescription(DECustomerCategory 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_CustomerCatagory 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);
        }
Exemple #9
0
        public int DeleteData(DECustomerCategory catagory)
        {
            int int_Result;

            SqlCommand sqlCmd = new SqlCommand();

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

            DeclareSqlCmdParameter(sqlCmd, catagory);

            int_Result = SqlConjunction.GetSQLVoid(sqlCmd);

            sqlCmd = null;

            return(int_Result);
        }
Exemple #10
0
        public int InsertData(DECustomerCategory catagory)
        {
            DALCustomerCategory obj_DALCatagory = new DALCustomerCategory();

            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);
        }
Exemple #11
0
        private void dgv_Catagory_DoubleClick(object sender, EventArgs e)
        {
            DECustomerCategory catagory = new DECustomerCategory();

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

            BLLCustomerCategory obj_BLLCatagory = new BLLCustomerCategory();
            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;
        }
Exemple #12
0
        public Boolean LoadCatagoryRow(DECustomerCategory catagory)
        {
            Boolean bool_HasRows = false;

            SqlCommand sqlCmd = new SqlCommand();

            sqlCmd.CommandText = "SELECT Catagory_Id,Catagory_Description,Active,ModifiedBy,ModifiedDate FROM tbl_CustomerCatagory 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);
        }
Exemple #13
0
        private void BindDataGridView()
        {
            DECustomerCategory catagory = new DECustomerCategory();

            BLLCustomerCategory obj_BLLCatagory = new BLLCustomerCategory();

            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();
        }
Exemple #14
0
 private void DisplayData(DECustomerCategory catagory)
 {
     txt_CatagoryDescription.Tag  = catagory.Catagory_Id;
     txt_CatagoryDescription.Text = catagory.Catagory_Description;
 }
Exemple #15
0
 private void AssignData(DECustomerCategory catagory)
 {
     catagory.Catagory_Id          = Convert.ToInt32(txt_CatagoryDescription.Tag);
     catagory.Catagory_Description = txt_CatagoryDescription.Text.Trim();
     catagory.ModifiedBy           = DEGlobal.str_UserName;
 }