private void button1_Click(object sender, EventArgs e) { string Result = ""; try { Result = DatabaseCalls.AddItem(ItemNewName_txt.Text, ItemModel_txt.Text, Convert.ToInt32(ItemQuantity_txt.Text), Convert.ToDecimal(ItemPrice_txt.Text), ItemPictureBox.ImageLocation, ItemCategory_txt.Text); if (Result.StartsWith("Item Added with") != true) { Variables.NotificationStatus = true; Variables.NotificationMessageTitle = this.Name; Variables.NotificationMessageText = Result; return; } ItemDataSet = DatabaseCalls.GetItems(); ItemCode_txt.Items.Clear(); foreach (DataRow asdf in ItemDataSet.Tables[0].Rows) { ItemCode_txt.Items.Add(asdf["CODE"]); } ItemCode_txt.Focus(); Variables.NotificationStatus = true; Variables.NotificationMessageTitle = this.Name; Variables.NotificationMessageText = Result; } catch (Exception ex) { Variables.NotificationStatus = true; Variables.NotificationMessageTitle = this.Name; Variables.NotificationMessageText = ex.Message; } }
/// <summary> /// Checks mandatory fields /// </summary> /// <returns></returns> private bool CheckMandatory() { //if (ItemId_cmb.Text == string.Empty || ItemId_cmb.SelectedIndex < 0) //{ // messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, ItemId_lbl.Text); // popUpMessage.Warning(messageData, Text); // ItemId_cmb.Focus(); // return false; //} if (ItemCode_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, ItemId_lbl.Text); popUpMessage.Warning(messageData, Text); ItemCode_txt.Focus(); return(false); } if (LineId_cmb.Text == string.Empty || LineId_cmb.SelectedIndex < 0) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, LineId_lbl.Text); popUpMessage.Warning(messageData, Text); LineId_cmb.Focus(); return(false); } return(true); }
private void AddDataToGrid() { try { decimal PriceMultiplied_TQuantity = (Convert.ToDecimal(Price_txt.Text) * Convert.ToDecimal(TQuantity_txt.Text)); string[] row = { (ConsignmentDataGridView.NewRowIndex + 1).ToString(), ItemCode_txt.Text, Description_txt.Text, Ctn_txt.Text, QtyPerBox_txt.Text, TQuantity_txt.Text, Price_txt.Text, PriceMultiplied_TQuantity.ToString() }; textBox7.Text = (ConsignmentDataGridView.NewRowIndex + 1).ToString(); textBox8.Text = (Convert.ToDecimal(textBox8.Text) + Convert.ToDecimal(Ctn_txt.Text)).ToString(); textBox1.Text = (Convert.ToDecimal(textBox1.Text) + Convert.ToDecimal(TQuantity_txt.Text)).ToString(); textBox9.Text = (Convert.ToDecimal(textBox9.Text) + PriceMultiplied_TQuantity).ToString(); RandomAlgos.AddDataInConsignmentFile((ConsignmentDataGridView.NewRowIndex).ToString(), ItemCode_txt.Text, Description_txt.Text, QtyPerBox_txt.Text, Ctn_txt.Text, TQuantity_txt.Text, Price_txt.Text, (Convert.ToDecimal(TQuantity_txt.Text) * Convert.ToDecimal(Price_txt.Text)).ToString(), ConsignmentNumber_txt.Text, textBox8.Text, textBox7.Text, textBox9.Text); ConsignmentDataGridView.Rows.Add(row); ConsignmentDataGridView.Update(); ItemCode_txt.Text = ""; QtyPerBox_txt.Text = "0"; Description_txt.Text = "None"; Ctn_txt.Text = "0"; TQuantity_txt.Text = "0"; Price_txt.Text = "0"; ItemCode_txt.Focus(); } catch (Exception ex) { Variables.NotificationStatus = true; Variables.NotificationMessageTitle = this.Name; Variables.NotificationMessageText = ex.Message; } }
/// <summary> /// Checks mandatory fields /// </summary> /// <returns></returns> private bool CheckMandatory() { if (ItemCode_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, ItemCode_lbl.Text); popUpMessage.Warning(messageData, Text); ItemCode_txt.Focus(); return(false); } if (ItemName_txt.Text == string.Empty) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, ItemName_lbl.Text); popUpMessage.Warning(messageData, Text); ItemName_txt.Focus(); return(false); } if (UnitType_cmb.Text == string.Empty || UnitType_cmb.SelectedIndex < 0) { messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, UnitType_lbl.Text); popUpMessage.Warning(messageData, Text); UnitType_cmb.Focus(); return(false); } return(true); }