Exemple #1
0
        private void txt_itemCode_Leave(object sender, EventArgs e)
        {
            try
            {
                DataTable dt = new DataTable();

                if (!string.IsNullOrEmpty(txt_itemCode.Text))
                {
                    //check the item code is exist in db
                    dt = MANAGEDB.getItemDataForStockEntry(txt_itemCode.Text);

                    if (dt.Rows.Count <= 0)
                    {
                        COM_MESSAGE.errorMessage("Item does not exsits !!!", "Input Error");
                    }
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }
Exemple #2
0
 private void txt_itemCode_KeyUp(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.KeyCode == Keys.Enter)
         {
             //check the item code is exists
             if (MANAGEDB.isItemCodeExists(txt_itemCode.Text))
             {
                 COM_MESSAGE.errorMessage("Item Code Alredy Registered !!!", "Code Exists");
             }
             else
             {
                 txt_itemName.Focus();
             }
         }
     }
     catch (Exception ex)
     {
         COM_MESSAGE.exceptionMessage(ex.Message);
     }
 }
Exemple #3
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            List <BLL.clsUserPermission> data = new List <BLL.clsUserPermission>();
            DataTable dt   = new DataTable();
            bool      isOK = false;

            try
            {
                //check for do action
                if (COMM_METHODS.checkActPermission(this.Name, USERNAME))
                {
                    foreach (DataGridViewColumn col in grd_userPermission.Columns)
                    {
                        dt.Columns.Add(col.HeaderText);
                    }

                    foreach (DataGridViewRow row in grd_userPermission.Rows)
                    {
                        DataRow dRow = dt.NewRow();
                        foreach (DataGridViewCell cell in row.Cells)
                        {
                            if (cell.Value == null)
                            {
                                dRow[cell.ColumnIndex] = 0;
                            }
                            else if (cell.Value is Boolean)
                            {
                                if (Convert.ToBoolean(cell.Value))
                                {
                                    dRow[cell.ColumnIndex] = 1;
                                }
                                else
                                {
                                    dRow[cell.ColumnIndex] = 0;
                                }
                            }
                            else
                            {
                                dRow[cell.ColumnIndex] = cell.Value;
                            }
                        }
                        dt.Rows.Add(dRow);
                    }

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        CheckBox chk_view = dt.Rows[i]["View Permission"] as CheckBox;
                        CheckBox chk_act  = dt.Rows[i]["Action Permission"] as CheckBox;

                        data.Add(new BLL.clsUserPermission()
                        {
                            _userRoleName = dt.Rows[i]["userRoleName"].ToString(),
                            _roleId       = Convert.ToInt32(dt.Rows[i]["userRoleId"]),
                            _formId       = Convert.ToInt32(dt.Rows[i]["formId"]),
                            _formName     = dt.Rows[i]["formName"].ToString(),
                            _project      = dt.Rows[i]["project"].ToString(),
                            _view         = Convert.ToInt16(dt.Rows[i]["View Permission"]),
                            _action       = Convert.ToInt16(dt.Rows[i]["Action Permission"])
                        });
                    }

                    //insert to db
                    isOK = MANAGEDB.insert_userPermission(data);

                    if (isOK)
                    {
                        COM_MESSAGE.successfullMessage("Successfully Updated user Permissions !!!");
                        this.Close();
                    }
                    else
                    {
                        COM_MESSAGE.errorMessage("user Permissions not updated successfully !!!", "EEROR");
                    }
                }
                else
                {
                    COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!");
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }

            Cursor.Current = Cursors.Default;
        }