private void LoginBtn_Click(object sender, EventArgs e) { //UserName.Text = "manou"; //UserPassword.Text = "123456QAS"; string MessageReturn = string.Empty; if (UserName.Text != "" && UserPassword.Text != "") { bool isLogin = false; TranstechClient TraCl = new TranstechClient(); try { TraCl.Open(); isLogin = TraCl.ZMM_TRANSTECH_AUTHENTICATION(UserName.Text, UserPassword.Text, ref MessageReturn, client_type); if (!isLogin)//Check for an error throw new Exception(MessageReturn); } catch (Exception Ex) { MessageBox.Show("שם המשתמש או הססמה שגויים!", "שגיאה", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { TraCl.Close(); } if (isLogin) { ResultText = UserName.Text; ResultPassword = UserPassword.Text; this.DialogResult = DialogResult.OK; this.Close(); } } else { MessageBox.Show("אנא מלא את שם המשתמש והססמה!", "מידע חסר",MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void update_Click(object sender, EventArgs e) { simplelogfile.LogToFile("update button orderitemsform "); int subrc = 0; //check how many entries there are in the list. int listsize = 0; foreach (order _orderItem in LIST_ORDER) // Loop through List with foreach { if (_orderItem._DONE == "OK") listsize++; } TranstechClient Client = new TranstechClient(); try { V_MIGO[] Migo = new V_MIGO[listsize]; int counter = 0; foreach (order _orderItem in LIST_ORDER) // Loop through List with foreach { if (_orderItem._DONE == "OK") { //decimal menge = Convert.ToDecimal(_orderItem._MENGE2); //if (menge != 0) //{ V_MIGO Migo_line = new V_MIGO(); //_orderItem._MENGE2 = "2"; Migo_line.MATERIAL = _orderItem._MATNR; Migo_line.PO_ITEM = _orderItem._EBELP; Migo_line.PO_NUMBER = _orderItem._EBELN; Migo_line.ENTRY_QNT = Convert.ToDecimal(_orderItem._MENGE2); Migo_line.STGE_LOC = _orderItem._LGORT; Migo[counter] = Migo_line; counter++; //} } } Client.Open(); DateTime EndDate = DateTime.Now; V_BAPIRETURN[] Bapireturn = new V_BAPIRETURN[0]; string MigoNumber = Client.ZMM_TRANSTECH_MIGO(LOGIN_NAME, LOGIN_PASSWORD, Migo, ref Bapireturn, "", EndDate.ToString("yyyy-MM-dd"), EndDate.ToString("yyyy-MM-dd"), "Test rub", ref subrc, ref MessageReturn, CLIENT_TYPE); string xxx = MigoNumber; //Label.Text = MigoNumber; //if (!String.IsNullOrEmpty(MessageReturn)) // Label.Text = MessageReturn; string s = String.Format("create MIGO subrc : {0} MigoNumber: {1} ", (subrc), MigoNumber); simplelogfile.LogToFile(s); dictionary.Clear(); if (subrc == 4)//Check for an error { string text = ": הנפקת טובין נכשלה "; //MessageBox.Show(text, "Message", MessageBoxButtons.OK); //MessageBox.Show(text, "Message", MessageBoxButtons.OK); MyMessageBox.ShowBox(text, "Message"); foreach (V_BAPIRETURN BapiLine in Bapireturn) { errorValues error = new errorValues(); int row = BapiLine.ROW - 1; error._MESSAGE = BapiLine.MESSAGE; error._TYPE = BapiLine.TYPE; error._ROW = dataGridViewWithItems.Rows[row].Cells["EBELP"].Value.ToString(); dictionary.Add(error._ROW, error); } //Refreash(sender, e); for (int i = 0; i < dataGridViewWithItems.RowCount; i++) { string ebelp = Convert.ToString(dataGridViewWithItems.Rows[i].Cells["EBELP"].Value); if (dictionary.ContainsKey(ebelp)) { errorValues getError = dictionary[ebelp]; dataGridViewWithItems.Rows[i].Cells["MESSAGE"].Value = getError._MESSAGE; dataGridViewWithItems.Rows[i].Cells["TYPE"].Value = getError._TYPE; dataGridViewWithItems.Rows[i].Cells["TYPE"].Style.BackColor = System.Drawing.Color.Red; } } } else if (subrc == 0) { string text = "הנפקת טובין בוצעה בהצלחה . מספר: " + MigoNumber ; //MessageBox.Show(text, "Message", MessageBoxButtons.OK); MyMessageBox.ShowBox(text, "Message"); Refreash(sender, e); } } catch (Exception Ex) { MessageBox.Show(Ex.Message); } finally { Client.Close(); } sendToMachineAccordingStatus(); }