コード例 #1
0
        private bool checkInsertedAssetData(List <Tuple <string, string> > assetData)
        {
            bool isError = false;

            try
            {
                for (int i = 0; i < assetData.Count; i++)
                {
                    switch (assetData[i].Item1)
                    {
                    case "assetName":
                        if (VALIDATION.isEmptyTextBox(assetData[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("Asset Name Cannot be Empty !!!");
                            isError = true;
                        }
                        else
                        {
                            if (!VALIDATION.isLetterAndNumberOnly(assetData[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("Asset Name should contains only Numbers and letters !!!");
                                isError = true;
                            }
                        }
                        break;

                    case "value":
                        if (!VALIDATION.isEmptyTextBox(assetData[i].Item2))
                        {
                            if (!VALIDATION.isDoubleValue(assetData[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("Value should contains only numbers !!!");
                                isError = true;
                            }
                        }
                        break;

                    case "quantity":
                        if (!VALIDATION.isEmptyTextBox(assetData[i].Item2))
                        {
                            if (!VALIDATION.isDoubleValue(assetData[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("quantity should contains only numbers !!!");
                                isError = true;
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(isError);
        }
コード例 #2
0
ファイル: FrmAddUnits.cs プロジェクト: sammmk/ERP
        private bool checkInsertedAssetData(List <Tuple <string, string> > dataList)
        {
            bool isError = false;

            try
            {
                for (int i = 0; i < dataList.Count; i++)
                {
                    switch (dataList[i].Item1)
                    {
                    case "description":
                        if (VALIDATION.isEmptyTextBox(dataList[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("Description Cannot be Empty !!!");
                            isError = true;
                        }
                        else
                        {
                            if (!VALIDATION.isLetterAndNumberOnly(dataList[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("Description should contains only Numbers and letters !!!");
                                isError = true;
                            }
                        }
                        break;

                    case "symbol":
                        if (VALIDATION.isEmptyTextBox(dataList[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("Symbol Cannot be Empty !!!");
                            isError = true;
                        }
                        else
                        {
                            if (!VALIDATION.isLetterAndNumberOnly(dataList[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("Symbol should contains only Numbers and letters !!!");
                                isError = true;
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(isError);
        }
コード例 #3
0
ファイル: FrmAddItemType.cs プロジェクト: sammmk/ERP
        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);
            }
        }
コード例 #4
0
ファイル: FrmReleaseStock.cs プロジェクト: sammmk/ERP
        private bool checkInsertedReleaseEntry(List <Tuple <string, string> > dataList)
        {
            bool isError = false;

            try
            {
                for (int i = 0; i < dataList.Count; i++)
                {
                    switch (dataList[i].Item1)
                    {
                    case "comment":
                        if (!VALIDATION.isEmptyTextBox(dataList[i].Item2))
                        {
                            if (VALIDATION.isSpecialChars(dataList[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("comment should not contains special characters !!!");
                                isError = true;
                            }
                        }
                        break;

                    case "destination":
                        if (VALIDATION.isEmptyTextBox(dataList[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("Destination Cannot Be Empty !!!");
                            isError = true;
                        }
                        break;

                    case "stockEntryId":
                        if (VALIDATION.isEmptyTextBox(dataList[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("stock Id Cannot Be Empty !!!");
                            isError = true;
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(isError);
        }
コード例 #5
0
ファイル: FrmEditUnits.cs プロジェクト: sammmk/ERP
        private void txt_search_TextChanged(object sender, EventArgs e)
        {
            DataTable dt   = new DataTable();
            int       type = cmb_search.SelectedIndex;

            try
            {
                if (type > 0)
                {
                    if (!string.IsNullOrWhiteSpace(txt_search.Text))
                    {
                        dt = MANAGEDB.getUnitWhileSearching(type, txt_search.Text);
                        grd_editUnits.DataSource = dt;
                    }
                }
                else
                {
                    COM_MESSAGE.validationMessage("Please Select Type to Search ");
                }
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }
コード例 #6
0
        private void btn_search_Click(object sender, EventArgs e)
        {
            try
            {
                string str = String.Empty;

                if (chk_all.Checked)
                {
                    SEARCH = String.Empty;
                }
                else if (chk_date.Checked)
                {
                    SEARCH = string.Concat(" AND stockEntryDate BETWEEN '", dt_from.Value.Date.ToString("yyyy/MM/dd"), "' AND '", dt_to.Value.Date.ToString("yyyy/MM/dd"), "' ");
                }
                else if (chk_itemCode.Checked)
                {
                    if (!string.IsNullOrEmpty(txt_itemCode.Text))
                    {
                        SEARCH = string.Concat(" AND itemCode = ", txt_itemCode.Text);
                    }
                    else
                    {
                        COM_MESSAGE.validationMessage("Item Code Cannot be Empty !!!");
                    }
                }
                else
                {
                    SEARCH = String.Empty;
                }

                fillGrid(SEARCH);
            }
            catch (Exception ex)
            {
                COM_MESSAGE.exceptionMessage(ex.Message);
            }
        }
コード例 #7
0
ファイル: FrmAddDealers.cs プロジェクト: sammmk/ERP
        private bool checkInsertedDealerData(List <Tuple <string, string> > dealerData)
        {
            bool isError = false;

            try
            {
                for (int i = 0; i < dealerData.Count; i++)
                {
                    switch (dealerData[i].Item1)
                    {
                    case "dealerName":
                        if (VALIDATION.isEmptyTextBox(dealerData[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("Dealer Name Cannot be Empty !!!");
                            isError = true;
                        }
                        else
                        {
                            if (!VALIDATION.isLetterAndNumberOnly(dealerData[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("Dealer Name should contains only Numbers and letters !!!");
                                isError = true;
                            }
                        }
                        break;

                    case "companyName":
                        if (VALIDATION.isEmptyTextBox(dealerData[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("Company Name Cannot be Empty !!!");
                            isError = true;
                        }
                        else
                        {
                            if (!VALIDATION.isLetterAndNumberOnly(dealerData[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("Company Name should contains only Numbers and letters !!!");
                                isError = true;
                            }
                        }
                        break;

                    case "phoneNo":
                        if (!VALIDATION.isEmptyTextBox(dealerData[i].Item2))
                        {
                            if (!VALIDATION.isNumberOnly(dealerData[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("Phone Number should contains only numbers !!!");
                                isError = true;
                            }
                        }
                        break;

                    case "mobile":
                        if (!VALIDATION.isEmptyTextBox(dealerData[i].Item2))
                        {
                            if (!VALIDATION.isNumberOnly(dealerData[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("Mobile Phone Number should contains only numbers !!!");
                                isError = true;
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(isError);
        }
コード例 #8
0
ファイル: FrmAddTax.cs プロジェクト: sammmk/ERP
        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);
            }
        }
コード例 #9
0
        private bool checkInsertedItemData(List <Tuple <string, string> > userData)
        {
            bool isError = false;

            try
            {
                for (int i = 0; i < userData.Count; i++)
                {
                    switch (userData[i].Item1)
                    {
                    case "itemCode":
                        if (VALIDATION.isEmptyTextBox(userData[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("Item Code Cannot be Empty !!!");
                            isError = true;
                        }
                        else
                        {
                            if (!VALIDATION.isLetterAndNumberOnly(userData[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("Item Code should contains only Numbers !!!");
                                isError = true;
                            }
                        }
                        break;

                    case "itemName":
                        if (VALIDATION.isEmptyTextBox(userData[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("Item Name Cannot be Empty !!!");
                            isError = true;
                        }
                        else
                        {
                            if (VALIDATION.isSpecialChars(userData[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("Item Name should not contains special characters !!!");
                                isError = true;
                            }
                        }
                        break;

                    case "altName":
                        if (!VALIDATION.isEmptyTextBox(userData[i].Item2))
                        {
                            if (VALIDATION.isSpecialChars(userData[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("Alternative Name should not contains special characters !!!");
                                isError = true;
                            }
                        }
                        break;

                    case "itemType":
                        if (VALIDATION.isEmptyTextBox(userData[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("Item Type Cannot be Empty !!!");
                            isError = true;
                        }
                        break;

                    default:
                        isError = true;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(isError);
        }
コード例 #10
0
ファイル: FrmStockIntake.cs プロジェクト: sammmk/ERP
        private bool checkInsertedStockEntry(List <Tuple <string, string> > stockEntry)
        {
            bool isError = false;

            try
            {
                for (int i = 0; i < stockEntry.Count; i++)
                {
                    switch (stockEntry[i].Item1)
                    {
                    case "quantity":
                        if (VALIDATION.isEmptyTextBox(stockEntry[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("Quantity Cannot be Empty !!!");
                            isError = true;
                        }
                        else
                        {
                            if (!VALIDATION.isDoubleValue(stockEntry[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("Quantity is not Correct in format !!!");
                                isError = true;
                            }
                        }
                        break;

                    case "buyingUnitPrice":
                        if (VALIDATION.isEmptyTextBox(stockEntry[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("Buying Unit Price Cannot be Empty !!!");
                            isError = true;
                        }
                        else
                        {
                            if (!VALIDATION.isDoubleValue(stockEntry[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("Buying Unit Price is not in Correct format !!!");
                                isError = true;
                            }
                        }
                        break;

                    case "sellingUnitPrice":
                        if (VALIDATION.isEmptyTextBox(stockEntry[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("Selling Unit Price Cannot be Empty !!!");
                            isError = true;
                        }
                        else
                        {
                            if (!VALIDATION.isDoubleValue(stockEntry[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("Selling Unit Price is not in Correct format !!!");
                                isError = true;
                            }
                        }
                        break;

                    case "priceAfterDiscount":
                        if (!VALIDATION.isEmptyTextBox(stockEntry[i].Item2))
                        {
                            if (!VALIDATION.isDoubleValue(stockEntry[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("Price After Discount is not in Correct format !!!");
                                isError = true;
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(isError);
        }
コード例 #11
0
ファイル: FrmCreateUser.cs プロジェクト: sammmk/ERP
        private bool checkInsertedUserData(List <Tuple <string, string> > userData)
        {
            bool isError = false;

            try
            {
                for (int i = 0; i < userData.Count; i++)
                {
                    switch (userData[i].Item1)
                    {
                    //validate User Name
                    case "userName":
                        if (VALIDATION.isEmptyTextBox(userData[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("User Name Cannot be Empty !!!");
                            isError = true;
                        }
                        else
                        {
                            if (!VALIDATION.isLetterAndNumberOnly(userData[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("User Name should contains only Letters and Numbers !!!");
                                isError = true;
                            }
                        }
                        break;

                    //validate First Name
                    case "firstName":
                        if (VALIDATION.isEmptyTextBox(userData[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("First Name Cannot be Empty !!!");
                            isError = true;
                        }
                        else
                        {
                            if (!VALIDATION.isLetterOnly(userData[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("First Name should contains only Letters !!!");
                                isError = true;
                            }
                        }
                        break;

                    //validate Last Name
                    case "lastName":
                        if (VALIDATION.isEmptyTextBox(userData[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("Last Name Cannot be Empty !!!");
                            isError = true;
                        }
                        else
                        {
                            if (!VALIDATION.isLetterOnly(userData[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("Last Name should contains only Letters !!!");
                                isError = true;
                            }
                        }
                        break;

                    //validate NIC
                    case "idNumber":
                        if (VALIDATION.isEmptyTextBox(userData[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("NIC Cannot be Empty !!!");
                            isError = true;
                        }
                        else
                        {
                            if (!VALIDATION.isLetterAndNumberOnly(userData[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("NIC should contains only Letters and Numbers !!!");
                                isError = true;
                            }
                        }
                        break;

                    //validate email - it can be empty
                    case "email":
                        if (!VALIDATION.isEmptyTextBox(userData[i].Item2))
                        {
                            if (!VALIDATION.isEmail(userData[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("email is not in correct format !!!");
                                isError = true;
                            }
                        }
                        break;

                    //validate user Role
                    case "userRole":
                        if (VALIDATION.isEmptyTextBox(userData[i].Item2))
                        {
                            COM_MESSAGE.validationMessage("User Role Cannot be Empty !!!");
                            isError = true;
                        }
                        break;

                    //validate Phone number
                    case "phoneNo":
                        if (!VALIDATION.isEmptyTextBox(userData[i].Item2))
                        {
                            if (!VALIDATION.isNumberOnly(userData[i].Item2))
                            {
                                COM_MESSAGE.validationMessage("Phone Number should contains only Numbers !!!");
                                isError = true;
                            }
                        }
                        break;

                    default:
                        isError = true;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(isError);
        }
コード例 #12
0
ファイル: FrmCreateUser.cs プロジェクト: sammmk/ERP
        private void btn_create_Click(object sender, EventArgs e)
        {
            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.SelectedItem.ToString();
            string phoneNo   = txt_phoneNumber.Text;

            //validate User Name
            if (VALIDATION.isEmptyTextBox(userName))
            {
                COM_MESSAGE.validationMessage("User Name Cannot be Empty !!!");
                isError = true;
            }
            else
            {
                if (!VALIDATION.isLetterAndNumberOnly(userName))
                {
                    COM_MESSAGE.validationMessage("User Name should contains only Letters and Numbers !!!");
                    isError = true;
                }
            }

            //validate First Name
            if (VALIDATION.isEmptyTextBox(firstName))
            {
                COM_MESSAGE.validationMessage("First Name Cannot be Empty !!!");
                isError = true;
            }
            else
            {
                if (!VALIDATION.isLetterOnly(firstName))
                {
                    COM_MESSAGE.validationMessage("First Name should contains only Letters !!!");
                    isError = true;
                }
            }

            //validate Last Name
            if (VALIDATION.isEmptyTextBox(lastName))
            {
                COM_MESSAGE.validationMessage("Last Name Cannot be Empty !!!");
                isError = true;
            }
            else
            {
                if (!VALIDATION.isLetterOnly(lastName))
                {
                    COM_MESSAGE.validationMessage("Last Name should contains only Letters !!!");
                    isError = true;
                }
            }

            //validate NIC
            if (VALIDATION.isEmptyTextBox(idNumber))
            {
                COM_MESSAGE.validationMessage("NIC Cannot be Empty !!!");
                isError = true;
            }
            else
            {
                if (!VALIDATION.isLetterAndNumberOnly(idNumber))
                {
                    COM_MESSAGE.validationMessage("NIC should contains only Letters and Numbers !!!");
                    isError = true;
                }
            }

            //validate email - it can be empty
            if (!VALIDATION.isEmptyTextBox(email))
            {
                if (!VALIDATION.isEmail(email))
                {
                    COM_MESSAGE.validationMessage("email is not in correct format !!!");
                    isError = true;
                }
            }

            //validate user Role
            if (VALIDATION.isEmptyTextBox(userRole))
            {
                COM_MESSAGE.validationMessage("User Role Cannot be Empty !!!");
                isError = true;
            }

            //validate Phone number
            if (!VALIDATION.isEmptyTextBox(phoneNo))
            {
                if (!VALIDATION.isNumberOnly(phoneNo))
                {
                    COM_MESSAGE.validationMessage("Phone Number should contains only Numbers !!!");
                    isError = true;
                }
            }

            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);
            }
        }