Esempio n. 1
0
        private void btn_delete_Click(object sender, EventArgs e)
        {
            DialogResult result = COM_MESSAGE.warningMessage("You are going to DELETE the user....\n\r Are you Sure???", "Delete the Item");

            if (result == DialogResult.Yes)
            {
                if (MANAGEDB.deleteItem(Convert.ToInt32(txt_itemID.Text)))
                {
                    IS_SUCCESS_MESSAGE = true;
                    this.Close();
                    COM_MESSAGE.successfullMessage("Successfully deleted the User");
                }
            }
        }
Esempio n. 2
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            bool   isError      = false;
            int    itemTypeIdId = Convert.ToInt16(txt_itemTypeID.Text);
            string itemType     = txt_itemType.Text;

            try
            {
                //check for do action
                if (COMM_METHODS.checkActPermission(this.Name, USERNAME))
                {
                    //validate item Type name
                    if (VALIDATION.isEmptyTextBox(itemType))
                    {
                        COM_MESSAGE.validationMessage("Item Type Cannot be Empty !!!");
                        isError = true;
                    }
                    else
                    {
                        if (!VALIDATION.isLetterAndNumberOnly(itemType))
                        {
                            COM_MESSAGE.validationMessage("Item Type should contains only Letters and Numbers !!!");
                            isError = true;
                        }
                    }

                    if (!isError)
                    {
                        //insert data to tbl_itemtype
                        if (MANAGEDB.insertData_itemType(itemTypeIdId, itemType))
                        {
                            IS_SUCCESS_MESSAGE = true;
                            COM_MESSAGE.successfullMessage("Successfully created the Item Type !!!");
                            clearAllText(this);
                            txt_itemTypeID.Text = MANAGEDB.getMaxItemTypeID().ToString();
                            txt_itemType.Focus();
                        }
                    }
                }
                else
                {
                    COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!");
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }
Esempio n. 3
0
        private void btn_release_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            try
            {
                //check for do action
                if (COMM_METHODS.checkActPermission(this.Name, USERNAME))
                {
                    if (MANAGEDB.insertData_stockRelease(ORDER))
                    {
                        COM_MESSAGE.successfullMessage("Successfully Released from the Stock ");

                        //issue the invoice

                        COMM_METHODS.clearAllText(this);
                        setReleaseId();
                        dt_delivery.Value = DateTime.Today;
                        grd_releaseStock.Rows.Clear();
                        grd_releaseStock.Refresh();
                        txt_itemCode.Focus();
                    }
                }
                else
                {
                    COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!");
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }

            Cursor.Current = Cursors.Default;
        }
Esempio n. 4
0
        private void btn_update_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            try
            {
                //check for do action
                if (COMM_METHODS.checkActPermission(this.Name, USERNAME))
                {
                    bool             isError      = false;
                    BLL.ClsStockData newStockData = new BLL.ClsStockData();
                    var dataList = new List <Tuple <string, string> >();

                    dataList.Add(new Tuple <string, string>("quantity", txt_quantity.Text));
                    dataList.Add(new Tuple <string, string>("buyingUnitPrice", txt_buyUnitPrice.Text));
                    dataList.Add(new Tuple <string, string>("sellingUnitPrice", txt_sellUnitPrice.Text));
                    dataList.Add(new Tuple <string, string>("priceAfterDiscount", txt_sellUnitPrice.Text));

                    isError = checkInsertedStockEntry(dataList);

                    if (!isError)
                    {
                        newStockData._stockEntryId   = Convert.ToInt64(txt_entryId.Text);
                        newStockData._itemCode       = txt_itemCode.Text;
                        newStockData._itemId         = Convert.ToInt32(txt_itemId.Text);
                        newStockData._quantity       = Convert.ToDouble(txt_quantity.Text);
                        newStockData._buyUnitPrice   = Convert.ToDouble(txt_buyUnitPrice.Text);
                        newStockData._sellUnitPrice  = Convert.ToDouble(txt_sellUnitPrice.Text);
                        newStockData._stockEntryDate = dateTime_stockEntry.Value; //Convert.ToDateTime(txt_stockEntryDate.Text);
                        newStockData._expireDate     = dateTime_expire.Value;     //Convert.ToDateTime(txt_expireDate.Text);
                        //newStockData._createDate = DateTime.Today;
                        newStockData._totalValue         = Convert.ToDouble(txt_totalValue.Text);
                        newStockData._updateDate         = DateTime.Today;
                        newStockData._remainQuantity     = Convert.ToDouble(txt_remainQuantity.Text);
                        newStockData._priceAfterDiscount = Convert.ToDouble(txt_priceAfterDiscount.Text);
                        newStockData._comment            = txt_comment.Text;
                        newStockData._misPlacedQty       = Convert.ToDouble(txt_misPlaced.Text);
                        newStockData._dealerId           = Convert.ToInt32(txt_dealerId.Text);
                        newStockData._stockUnitId        = dropDown_stockUnit.SelectedIndex;

                        if (MANAGEDB.updateData_stockEntry(newStockData))
                        {
                            COM_MESSAGE.successfullMessage("Successfully Updated the Stock Entry ");
                            IS_SUCCESS_MESSAGE = true;
                            this.Close();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }

            Cursor.Current = Cursors.Default;
        }
Esempio n. 5
0
        private void btn_delete_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult result = COM_MESSAGE.warningMessage("You are going to DELETE a Unit....\n\r Are you Sure???", "Delete A Measure Unit");

                if (result == DialogResult.Yes)
                {
                    if (MANAGEDB.deleteUnit(Convert.ToInt32(txt_unitId.Text)))
                    {
                        IS_SUCCESS_MESSAGE = true;
                        this.Close();
                        COM_MESSAGE.successfullMessage("Successfully deleted the Asset");
                    }
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }
Esempio n. 6
0
        //private void dateTime_stockEntry_ValueChanged(object sender, EventArgs e)
        //{
        //    txt_stockEntryDate.Text = dateTime_stockEntry.Value.Date.ToString("yyyy/MM/dd");
        //}

        //private void dateTime_expire_ValueChanged(object sender, EventArgs e)
        //{
        //    txt_expireDate.Text = dateTime_expire.Value.Date.ToString("yyyy/MM/dd");
        //}

        private void btn_add_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            try
            {
                //check for do action
                if (COMM_METHODS.checkActPermission(this.Name, USERNAME))
                {
                    bool isError = false;

                    var dataList = new List <Tuple <string, string> >();

                    dataList.Add(new Tuple <string, string>("quantity", txt_quantity.Text));
                    dataList.Add(new Tuple <string, string>("buyingUnitPrice", txt_buyUnitPrice.Text));
                    dataList.Add(new Tuple <string, string>("sellingUnitPrice", txt_sellUnitPrice.Text));
                    dataList.Add(new Tuple <string, string>("priceAfterDiscount", txt_sellUnitPrice.Text));

                    isError = checkInsertedStockEntry(dataList);

                    if (!isError)
                    {
                        //insert data to db
                        createStockData();

                        if (MANAGEDB.insertData_stockEntry(STOCKDATA))
                        {
                            COM_MESSAGE.successfullMessage("Successfully created the Stock Entry ");
                            COMM_METHODS.clearAllText(this);
                            setStockEntryId();
                            dateTime_stockEntry.Value = DateTime.Today;
                            fillGrid();
                            txt_itemCode.Focus();
                        }
                    }
                }
                else
                {
                    COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!");
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }

            Cursor.Current = Cursors.Default;
        }
Esempio n. 7
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;
        }
Esempio n. 8
0
        private void btn_create_Click(object sender, EventArgs e)
        {
            try
            {
                //check for do action
                if (COMM_METHODS.checkActPermission(this.Name, USERNAME))
                {
                    bool   isError   = false;
                    string userName  = txt_userName.Text;
                    string firstName = txt_firstName.Text;
                    string lastName  = txt_lastName.Text;
                    string idNumber  = txt_nic.Text;
                    string email     = txt_email.Text;
                    string userRole  = (dropDown_userRole.SelectedIndex != -1) ? dropDown_userRole.SelectedItem.ToString() : string.Empty;
                    string phoneNo   = txt_phoneNumber.Text;

                    var dataList = new List <Tuple <string, string> >();

                    dataList.Add(new Tuple <string, string>("userName", userName));
                    dataList.Add(new Tuple <string, string>("firstName", firstName));
                    dataList.Add(new Tuple <string, string>("lastName", lastName));
                    dataList.Add(new Tuple <string, string>("idNumber", idNumber));
                    dataList.Add(new Tuple <string, string>("email", email));
                    dataList.Add(new Tuple <string, string>("userRole", userRole));
                    dataList.Add(new Tuple <string, string>("phoneNo", phoneNo));

                    isError = checkInsertedUserData(dataList);

                    if (!isError)
                    {
                        //insert data to db
                        CREATEUSER._userId    = Convert.ToInt16(txt_userID.Text);
                        CREATEUSER._userName  = userName;
                        CREATEUSER._firstName = firstName;
                        CREATEUSER._lastName  = lastName;
                        CREATEUSER._dob       = Convert.ToDateTime(txt_dob.Text);
                        CREATEUSER._idNumber  = idNumber;
                        CREATEUSER._address   = txt_address.Text;
                        CREATEUSER._email     = email;
                        CREATEUSER._userRole  = userRole;
                        CREATEUSER._roleId    = Convert.ToInt16(dropDown_userRole.SelectedValue);
                        CREATEUSER._phoneNo   = phoneNo;

                        //insert to tbl_userDetail and tbl_login
                        if (MANAGEDB.InsertData_userDetail(CREATEUSER))
                        {
                            COM_MESSAGE.successfullMessage("Successfully created the user ");
                            COMM_METHODS.clearAllText(this);
                            dropDown_userRole.SelectedIndex = -1;
                            txt_userID.Text = MANAGEDB.getMaxUserID().ToString();
                        }
                    }
                }
                else
                {
                    COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!");
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }