Ejemplo n.º 1
0
        public List <BOSecondCategory> selectSecondCatelist(BOSecondCategory _boseccat)
        {
            SqlCommand     _sqlcommand;
            SqlDataAdapter _sqlDataAdapter;

            using (SqlConnection _con = ConnectionInfo.GetConnection())
            {
                _sqlcommand             = new SqlCommand();
                _sqlcommand.CommandText = "SP_GetSecondCategory";
                _sqlcommand.CommandType = System.Data.CommandType.StoredProcedure;
                _sqlcommand.Connection  = _con;
                _con.Open();
                _sqlcommand.Parameters.AddWithValue("@Event", _boseccat.Event);
                _sqlDataAdapter = new SqlDataAdapter(_sqlcommand);

                DataTable _dataTable = new DataTable();
                _sqlDataAdapter.Fill(_dataTable);

                List <BOSecondCategory> _merfr = (from cu in _dataTable.AsEnumerable()
                                                  select new BOSecondCategory
                {
                    SecondCategoryId = cu.Field <int>("SecondCategoryId"),
                    SecondCategoryName = cu.Field <string>("SecondCategoryName")
                }).ToList();

                return(_merfr);
            }
        }
Ejemplo n.º 2
0
 protected void btnRequest_Click(object sender, EventArgs e)
 {
     try
     {
         if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString())
         {
             Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
             BOSecondCategory _boscat = new BOSecondCategory();
             BASecondCategory _bascat = new BASecondCategory();
             _boscat.SecondCategoryName = txtcategory.Text;
             _boscat.TopCategoryId      = Convert.ToInt32(drpTopcategory.SelectedValue);
             _boscat.IsActive           = false;
             _boscat.IsDelete           = false;
             _boscat.CreatedBy          = merchantId;
             _boscat.CreatedDate        = DateTime.UtcNow;
             _boscat.UpdatedBy          = merchantId;
             _boscat.UpdatedDate        = DateTime.UtcNow;
             _boscat.Event = "Insert";
             int result = _bascat.Insert(_boscat);
             if (result == 1)
             {
                 ShowMessage("Category added successfully", MessageType.Success);
             }
         }
     }
     catch (Exception ex)
     {
         Common.LogError(ex);
         ShowMessage("Some technical error", MessageType.Warning);
     }
     txtcategory.Text = "";
 }
Ejemplo n.º 3
0
        private void FillSecondCategory()
        {
            BOSecondCategory _boseccat = new BOSecondCategory();

            _boseccat.Event = "GETALL";
            List <BOSecondCategory> _secCatlist = bascat.SelectSecondCategoryList(_boseccat);

            cmbSecondCategory.DataSource    = _secCatlist;
            cmbSecondCategory.DisplayMember = "SecondCategoryName";
            cmbSecondCategory.ValueMember   = "SecondCategoryId";
        }
Ejemplo n.º 4
0
        private void FillSecondCategoryCombo(string eventtxt, int topcatid)
        {
            BOSecondCategory        _boseccat   = new BOSecondCategory();
            BASecondCategory        bascat      = new BALayer.BASecondCategory();
            List <BOSecondCategory> _secCatlist = bascat.SelectSecondCatListWithTop(eventtxt, topcatid);

            cmbSecondcat.DataSource = null;
            if (_secCatlist.Count > 0)
            {
                cmbSecondcat.DataSource    = _secCatlist;
                cmbSecondcat.DisplayMember = "SecondCategoryName";
                cmbSecondcat.ValueMember   = "SecondCategoryId";
            }
        }
Ejemplo n.º 5
0
        public List <BOSecondCategory> SelectSecondCategoryList(BOSecondCategory secat)
        {
            DataTable _ta = new DataTable();

            _ta = SelectSecondCategory(secat);
            List <BOSecondCategory> _scatlist = (from sc in _ta.AsEnumerable()
                                                 select new BOSecondCategory
            {
                SecondCategoryId = sc.Field <int>("SecondCategoryId"),
                SecondCategoryName = sc.Field <string>("SecondCategoryName"),
                TopCategoryId = sc.Field <int>("TopCategoryId"),
                TopCategoryName = sc.Field <string>("TopCategoryName")
            }).ToList();

            return(_scatlist);
        }
Ejemplo n.º 6
0
        public int IUDSecondCategory(BOSecondCategory secat)
        {
            int        returnvalue = default(int);
            SqlCommand _sqlcommand;

            using (SqlConnection _sqlconnection = ConnectionInfo.GetConnection())
            {
                _sqlcommand = new SqlCommand();

                _sqlcommand.Connection  = _sqlconnection;
                _sqlcommand.CommandText = "SP_IUDSecondCategory";
                _sqlcommand.CommandType = CommandType.StoredProcedure;
                _sqlconnection.Open();

                _sqlcommand.Parameters.AddWithValue("@SecondCategoryId", secat.SecondCategoryId);
                _sqlcommand.Parameters.AddWithValue("@SecondCategoryName", secat.SecondCategoryName);
                _sqlcommand.Parameters.AddWithValue("@TopCategoryId", secat.TopCategoryId);
                _sqlcommand.Parameters.AddWithValue("@IsActive", secat.IsActive);
                _sqlcommand.Parameters.AddWithValue("@IsDelete", secat.IsDelete);
                _sqlcommand.Parameters.AddWithValue("@CreatedBy", secat.CreatedBy);
                _sqlcommand.Parameters.AddWithValue("@CreatedDate", secat.CreatedDate);
                _sqlcommand.Parameters.AddWithValue("@UpdatedBy", secat.UpdatedBy);
                _sqlcommand.Parameters.AddWithValue("@UpdatedDate", secat.UpdatedDate);
                _sqlcommand.Parameters.AddWithValue("@Event", secat.Event);
                _sqlcommand.Parameters.AddWithValue("@returnValue", 0).Direction = System.Data.ParameterDirection.InputOutput;

                try
                {
                    _sqlcommand.ExecuteNonQuery();
                    returnvalue = Convert.ToInt32(_sqlcommand.Parameters["@returnValue"].Value);
                }
                catch
                {
                    returnvalue = 100;
                }
                finally
                {
                    _sqlconnection.Close();
                    _sqlcommand.Dispose();
                }
            }
            return(returnvalue);
        }
Ejemplo n.º 7
0
 private void dgvSecondCategory_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (headval)
         {
             if (dgvSecondCategory.Columns[e.ColumnIndex].Name == "Edit")
             {
                 SecCatId = Convert.ToInt32(dgvSecondCategory.Rows[e.RowIndex].Cells[0].Value.ToString());
                 txtSecondCategory.Text = dgvSecondCategory.Rows[e.RowIndex].Cells[1].Value.ToString();
                 cmbTopCategory.Text    = dgvSecondCategory.Rows[e.RowIndex].Cells[2].Value.ToString();
                 btnAdd.Text            = "Update";
             }
             else if (dgvSecondCategory.Columns[e.ColumnIndex].Name == "Delete")
             {
                 DialogResult result1 = MessageBox.Show("Are you sure you want to delete\nrecord " + dgvSecondCategory.Rows[e.RowIndex].Cells[1].Value.ToString() + " ?", "Warning", MessageBoxButtons.YesNo);
                 if (result1 == DialogResult.Yes)
                 {
                     SecCatId = Convert.ToInt32(dgvSecondCategory.Rows[e.RowIndex].Cells[0].Value.ToString());
                     BOSecondCategory _boscat = new BOSecondCategory();
                     _boscat.SecondCategoryId   = SecCatId;
                     _boscat.SecondCategoryName = txtSecondCategory.Text;
                     _boscat.TopCategoryId      = Convert.ToInt32(cmbTopCategory.SelectedValue);
                     _boscat.IsActive           = true;
                     _boscat.IsDelete           = true;
                     _boscat.CreatedBy          = loginID;
                     _boscat.CreatedDate        = DateTime.UtcNow;
                     _boscat.UpdatedBy          = loginID;
                     _boscat.UpdatedDate        = DateTime.UtcNow;
                     _boscat.Event = "Delete";
                     MessageBox.Show(Common.Message(dgvSecondCategory.Rows[e.RowIndex].Cells[1].Value.ToString(), bscat.Delete(_boscat)));
                     ClearControl();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 8
0
        public DataTable SelectSecondCategory(BOSecondCategory secat)
        {
            SqlCommand     _sqlcommand;
            SqlDataAdapter _sqlDataAdapter;

            using (SqlConnection _con = ConnectionInfo.GetConnection())
            {
                _sqlcommand             = new SqlCommand();
                _sqlcommand.CommandText = "SP_GetSecondCategory";
                _sqlcommand.CommandType = System.Data.CommandType.StoredProcedure;
                _sqlcommand.Connection  = _con;
                _con.Open();
                _sqlcommand.Parameters.AddWithValue("@Event", secat.Event);
                _sqlDataAdapter = new SqlDataAdapter(_sqlcommand);

                DataTable _dataTable = new DataTable();
                _sqlDataAdapter.Fill(_dataTable);
                _con.Close();
                return(_dataTable);
            }
        }
Ejemplo n.º 9
0
 public List <BOSecondCategory> SelectSecondCategoryList(BOSecondCategory _boseccat)
 {
     return(_dascecat.selectSecondCatelist(_boseccat));
 }
Ejemplo n.º 10
0
 public List <BOSecondCategory> SelectSecondCategoryList(BOSecondCategory _boscat)
 {
     return(dascat.SelectSecondCategoryList(_boscat));
 }
Ejemplo n.º 11
0
 public int Delete(BOSecondCategory _boscat)
 {
     return(dascat.IUDSecondCategory(_boscat));
 }
Ejemplo n.º 12
0
 public int Insert(BOSecondCategory _boscat)
 {
     return(dascat.IUDSecondCategory(_boscat));
 }
Ejemplo n.º 13
0
 public DataTable SelectSecondCategory(BOSecondCategory _boscat)
 {
     return(dascat.SelectSecondCategory(_boscat));
 }
Ejemplo n.º 14
0
 public int Update(BOSecondCategory _boscat)
 {
     return(_dascat.IUDSecondCategory(_boscat));
 }
Ejemplo n.º 15
0
 internal int Insert(BOSecondCategory _boscat)
 {
     return(_daseccat.IUD(_boscat));
 }