Example #1
0
 private void idBtnCancel_Click(object sender, EventArgs e)
 {
     FormCancelButton = true;
     if (InitFromMenu != true)
     {
         MastersItem obj = new MastersItem();
         obj.Show();
     }
     this.Close();
 }
Example #2
0
 private void Items_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (FormCancelButton == false)
     {
         if (InitFromMenu != true)
         {
             MastersItem obj = new MastersItem();
             obj.Show();
         }
     }
 }
Example #3
0
        private void itemMasterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MastersItem objmi = new MastersItem();

            objmi.Show();
        }
Example #4
0
        private void idBtnAddItems_Click(object sender, EventArgs e)
        {
            MastersItem objmi = new MastersItem();

            objmi.Show();
        }
Example #5
0
        private void idBtnSave_Click(object sender, EventArgs e)
        {
            var objItemInfo  = GetValueFromTextBox();
            var ErrorCounter = 0;
            var ErrorMessage = "Following fields should not be empty \n\n";

            if (string.IsNullOrEmpty(objItemInfo.Name))
            {
                ErrorCounter++;
                ErrorMessage += ErrorCounter.ToString() + "] " + "Please Enter Item Name \n";
            }
            if (string.IsNullOrEmpty(objItemInfo.Unit))
            {
                ErrorCounter++;
                ErrorMessage += ErrorCounter.ToString() + "] " + "Please Select Unit \n";
            }
            if (string.IsNullOrEmpty(objItemInfo.Rate))
            {
                ErrorCounter++;
                ErrorMessage += ErrorCounter.ToString() + "] " + "Please enter price \n";
            }
            if (!string.IsNullOrEmpty(objItemInfo.Rate))
            {
                float temp   = 0;
                var   str    = objItemInfo.Rate.ToString();
                var   fValue = float.TryParse(str, out temp);
                if (fValue == false)
                {
                    ErrorCounter++;
                    ErrorMessage += ErrorCounter.ToString() + "] " + "Price should be numeric value. \n";
                }
            }
            if (ErrorCounter > 0)
            {
                MessageBox.Show(ErrorMessage, "Warning !...");
                return;
            }



            if (string.IsNullOrEmpty(objItemInfo.ID))
            {
                var IsPresent = ItemsBl.IsItemAlreadyPresent(objItemInfo.Name);
                if (IsPresent == true)
                {
                    MessageBox.Show("Item already Exist with Name : " + objItemInfo.Name, "Warning !...");
                    return;
                }
                ItemsBl.SaveItem(objItemInfo);
            }
            else
            {
                ItemsBl.UpdateItem(objItemInfo);
            }

            FormCancelButton = true;
            if (InitFromMenu != true)
            {
                MastersItem obj = new MastersItem();
                obj.Show();
            }
            this.Close();
        }