Пример #1
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 itemId    = txt_itemID.Text;
                    string itemCode  = txt_itemCode.Text;
                    string itemName  = txt_itemName.Text;
                    string altName   = txt_altName.Text;
                    string itemType  = (dropDown_itemType.SelectedIndex != -1) ? dropDown_itemType.SelectedItem.ToString() : string.Empty;
                    string stockUnit = (dropDown_stockUnit.SelectedIndex != -1) ? dropDown_stockUnit.SelectedItem.ToString() : string.Empty;
                    string shopUnit  = (dropDown_shopUnit.SelectedIndex != -1) ? dropDown_shopUnit.SelectedItem.ToString() : string.Empty;

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

                    dataList.Add(new Tuple <string, string>("itemCode", itemCode));
                    dataList.Add(new Tuple <string, string>("itemName", itemName));
                    dataList.Add(new Tuple <string, string>("altName", altName));
                    dataList.Add(new Tuple <string, string>("itemType", itemType));
                    dataList.Add(new Tuple <string, string>("stockUnitId", itemType));
                    dataList.Add(new Tuple <string, string>("shopUnitId", itemType));

                    isError = checkInsertedItemData(dataList);

                    if (!isError)
                    {
                        //insert data to db
                        CREATEITEM._itemId      = Convert.ToInt32(itemId);
                        CREATEITEM._itemCode    = itemCode;
                        CREATEITEM._itemName    = itemName;
                        CREATEITEM._altName     = altName;
                        CREATEITEM._itemTypeId  = Convert.ToInt32(dropDown_itemType.SelectedValue);
                        CREATEITEM._stockUnitId = Convert.ToInt32(dropDown_stockUnit.SelectedValue);
                        CREATEITEM._shopUnitId  = Convert.ToInt32(dropDown_shopUnit.SelectedValue);

                        if (MANAGEDB.insertData_item(CREATEITEM))
                        {
                            COM_MESSAGE.successfullMessage("Successfully created the Item ");
                            COMM_METHODS.clearAllText(this);
                            filldropDownLists();
                            txt_itemID.Text = MANAGEDB.getMaxItemId().ToString();
                        }
                    }
                }
                else
                {
                    COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!");
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }
Пример #2
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 dealerId    = txt_dealerID.Text;
                    string dealerName  = txt_dealerName.Text;
                    string companyName = txt_companyName.Text;
                    string address     = txt_address.Text;
                    string phoneNo     = txt_phoneNo.Text;
                    string mobile      = txt_mobile.Text;

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

                    dataList.Add(new Tuple <string, string>("dealerName", dealerName));
                    dataList.Add(new Tuple <string, string>("companyName", companyName));
                    dataList.Add(new Tuple <string, string>("phoneNo", phoneNo));
                    dataList.Add(new Tuple <string, string>("mobile", mobile));

                    isError = checkInsertedDealerData(dataList);

                    if (!isError)
                    {
                        //insert data to db
                        ADD_DEALER._dealerId    = Convert.ToInt32(dealerId);
                        ADD_DEALER._dealerName  = dealerName;
                        ADD_DEALER._companyName = companyName;
                        ADD_DEALER._address     = address;
                        ADD_DEALER._phoneNo     = phoneNo;
                        ADD_DEALER._mobile      = mobile;

                        if (MANAGEDB.insertData_dealer(ADD_DEALER))
                        {
                            COM_MESSAGE.successfullMessage("Successfully created the Item ");
                            COMM_METHODS.clearAllText(this);
                            txt_dealerID.Text = MANAGEDB.getMaxDealerId().ToString();
                        }
                    }
                }
                else
                {
                    COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!");
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }
Пример #3
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 assetId     = txt_assetId.Text;
                    string assetName   = txt_assetName.Text;
                    string value       = txt_value.Text;
                    string description = txt_description.Text;
                    string quantity    = txt_quantity.Text;
                    string totalValue  = txt_total.Text;

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

                    dataList.Add(new Tuple <string, string>("assetName", assetName));
                    dataList.Add(new Tuple <string, string>("value", value));
                    dataList.Add(new Tuple <string, string>("quantity", quantity));

                    isError = checkInsertedAssetData(dataList);

                    if (!isError)
                    {
                        //insert data to db
                        ADD_ASSET._assetId    = Convert.ToInt32(assetId);
                        ADD_ASSET._assetName  = assetName;
                        ADD_ASSET._value      = (!string.IsNullOrEmpty(value)) ? Convert.ToDouble(value) : 0;
                        ADD_ASSET._descrption = description;
                        ADD_ASSET._quantity   = (!string.IsNullOrEmpty(quantity)) ? Convert.ToDouble(quantity) : 0;
                        ADD_ASSET._totalValue = (!string.IsNullOrEmpty(totalValue)) ? Convert.ToDouble(totalValue) : 0;

                        if (MANAGEDB.insertData_asset(ADD_ASSET))
                        {
                            COM_MESSAGE.successfullMessage("Successfully Insert the Asset ");
                            COMM_METHODS.clearAllText(this);
                            txt_assetId.Text = MANAGEDB.getMaxAssetId().ToString();
                        }
                    }
                }
                else
                {
                    COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!");
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }
Пример #4
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);
            }
        }
Пример #5
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;
        }
Пример #6
0
        private void grd_editUnits_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;
            int unitId     = 0;

            BLL.ClsUnitData unitData = new BLL.ClsUnitData();

            try
            {
                //check for do action
                if (COMM_METHODS.checkActPermission(this.Name, USERNAME))
                {
                    if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
                    {
                        unitId   = Convert.ToInt32(senderGrid.SelectedCells[e.ColumnIndex].Value);
                        unitData = MANAGEDB.getSingleUnitData(unitId);

                        FrmAddUnits frmAddUnits = new FrmAddUnits(unitData, USERNAME);
                        frmAddUnits.WindowState = FormWindowState.Normal;
                        frmAddUnits.ShowDialog();
                        grd_editUnits.DataSource = MANAGEDB.getUnitDetails();
                    }
                }
                else
                {
                    COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!");
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }
Пример #7
0
        private void grd_editRole_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;
            int roleId     = 0;

            BLL.clsUserRoleData roledata = new BLL.clsUserRoleData();

            try
            {
                //check for do action
                if (COMM_METHODS.checkActPermission(this.Name, USERNAME))
                {
                    if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
                    {
                        roleId   = Convert.ToInt16(senderGrid.SelectedCells[e.ColumnIndex - 1].Value);
                        roledata = MANAGEDB.getSingleRoleData(roleId);

                        FrmAddUserRole addRole = new FrmAddUserRole(roledata, USERNAME);
                        addRole.WindowState = FormWindowState.Normal;
                        addRole.ShowDialog();
                        grd_editRole.DataSource = MANAGEDB.getUserRoleDetails();
                    }
                }
                else
                {
                    COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!");
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }
Пример #8
0
        private void grd_editStockEntry_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var  senderGrid   = (DataGridView)sender;
            long stockEctryId = 0;

            BLL.ClsStockData stockData = new BLL.ClsStockData();

            try
            {
                //check permission for do action
                if (COMM_METHODS.checkActPermission(this.Name, USERNAME))
                {
                    if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
                    {
                        stockEctryId = Convert.ToInt64(senderGrid.SelectedCells[e.ColumnIndex].Value);
                        stockData    = MANAGEDB.getSingleStockDetail(stockEctryId);

                        FrmAdjustStock frmUser = new FrmAdjustStock(stockData, USERNAME);
                        frmUser.WindowState = FormWindowState.Normal;
                        frmUser.ShowDialog();
                        fillGrid(SEARCH);
                        //grd_editStockEntry.DataSource = MANAGEDB.getStockDetails(SEARCHTYPE);
                    }
                }
                else
                {
                    COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!");
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }
Пример #9
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 unitId      = txt_unitId.Text;
                    string description = txt_description.Text;
                    string symbol      = txt_symbol.Text;

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

                    dataList.Add(new Tuple <string, string>("description", description));
                    dataList.Add(new Tuple <string, string>("symbol", symbol));

                    isError = checkInsertedAssetData(dataList);

                    if (!isError)
                    {
                        //insert data to db
                        ADD_UNIT._unitId      = Convert.ToInt32(unitId);
                        ADD_UNIT._description = description;
                        ADD_UNIT._symbol      = symbol;

                        if (MANAGEDB.insertData_unit(ADD_UNIT))
                        {
                            COM_MESSAGE.successfullMessage("Successfully Insert the Unit ");
                            COMM_METHODS.clearAllText(this);
                            txt_unitId.Text = MANAGEDB.getMaxUnitId().ToString();
                        }
                    }
                }
                else
                {
                    COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!");
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }
Пример #10
0
        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>("comment", txt_comment.Text));
                    dataList.Add(new Tuple <string, string>("destination", txt_destinationId.Text));
                    dataList.Add(new Tuple <string, string>("stockEntryId", txt_stockEntryId.Text));

                    isError = checkInsertedReleaseEntry(dataList);

                    if (!isError)
                    {
                        //insert to DataGrid
                        createDataRow();
                        txt_billAmt.Text = (Convert.ToDouble(txt_billAmt.Text) + Convert.ToDouble(txt_total.Text)).ToString();
                        clearAfterAdd();
                        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;
        }
Пример #11
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            try
            {
                //check for do action
                if (COMM_METHODS.checkActPermission(this.Name, USERNAME))
                {
                    bool     isError       = false;
                    string   taxId         = txt_taxId.Text;
                    string   symbol        = txt_symbol.Text;
                    string   description   = txt_description.Text;
                    string   taxPercentage = txt_taxPercentage.Text;
                    DateTime from          = DateTime.MinValue.Date;
                    DateTime to            = DateTime.MinValue.Date;

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

                    dataList.Add(new Tuple <string, string>("symbol", symbol));
                    dataList.Add(new Tuple <string, string>("description", description));
                    dataList.Add(new Tuple <string, string>("taxPercentage", taxPercentage));

                    isError = checkInsertedTaxData(dataList);

                    if (chk_timePeriod.Checked)
                    {
                        from = dateTime_from.Value.Date;
                        to   = dateTime_to.Value.Date;

                        if (from > to)
                        {
                            isError = true;
                            COM_MESSAGE.validationMessage("From Date cannot be greater than To Date !!!");
                        }
                    }

                    if (!isError)
                    {
                        //insert data to db
                        ADD_TAX._taxId         = Convert.ToInt32(taxId);
                        ADD_TAX._symbol        = symbol;
                        ADD_TAX._description   = description;
                        ADD_TAX._taxPercentage = Convert.ToDouble(taxPercentage);
                        ADD_TAX._effectFrom    = from;
                        ADD_TAX._effectTo      = to;


                        if (MANAGEDB.insertData_tax(ADD_TAX))
                        {
                            COM_MESSAGE.successfullMessage("Successfully Insert the Tax ");
                            COMM_METHODS.clearAllText(this);
                            txt_taxId.Text = MANAGEDB.getMaxTaxId().ToString();
                        }
                    }
                }
                else
                {
                    COM_MESSAGE.permissionMessage("Sorry You dont have permission to do action !!!");
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }
Пример #12
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;
        }
Пример #13
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);
            }
        }