private void cmdUsers_Click(object sender, System.EventArgs eventArgs) { int uID = 0; wcServerAPI.TUser wUser = new wcServerAPI.TUser(); if ((((Button)sender).Name) == this.cmdUserUpdate.Name) { ////Update user information if (txtUserName.Text.Trim() == "") { ////Make sure AT LEAST the name is filled in MessageBox.Show("You must have a Name filled in", "Entry Error...", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { ////Searching for the user to fill out the complete ////User information variable... Then update what we ////need to change if (wcServerAPI.GetUserById(System.Convert.ToInt32(txtUserID.Text), ref wUser, ref uID)) { wUser.Info.Name = txtUserName.Text.Trim(); wUser.RealName = txtUserRealName.Text.Trim(); wUser.From = txtUserFrom.Text.Trim(); wUser.Address1 = txtUserAddress1.Text.Trim(); wUser.Address2 = txtUserAddress2.Text.Trim(); wUser.City = txtUserCity.Text.Trim(); wUser.State = txtUserState.Text.Trim(); wUser.Zip = txtUserZip.Text.Trim(); wUser.Country = txtUserCountry.Text.Trim(); wUser.PhoneNumber = txtUserPhone.Text.Trim(); wcServerAPI.SetUserVariable(System.Convert.ToInt32(txtUserID.Text.Trim()), "Profile", "DataNumber", txtUserDataPhone.Text.Trim()); if (!wcServerAPI.UpdateUser(ref wUser)) { MessageBox.Show("Error updating the specified user", "WINS Error...", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Error accessing the specified user record", "WINS Error...", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else if ((((Button)sender).Name) == this.cmdUserCancel.Name) { ////Unload form this.Dispose(); } }
public short LoadUser() { try { wcServerAPI.TUser wUser = new wcServerAPI.TUser(); int uID = 0; if (wcServerAPI.GetUserById(mvarUID, ref wUser, ref uID)) { txtUserName.Text = wUser.Info.Name.Trim(); txtUserID.Text = wUser.Info.ID.ToString().Trim(); txtUserRealName.Text = wUser.RealName.Trim(); txtUserFrom.Text = wUser.From.Trim(); txtUserAddress1.Text = wUser.Address1.Trim(); txtUserAddress2.Text = wUser.Address2.Trim(); txtUserCity.Text = wUser.City.Trim(); txtUserState.Text = wUser.State.Trim(); txtUserZip.Text = wUser.Zip.Trim(); txtUserCountry.Text = wUser.Country.Trim(); txtUserPhone.Text = wUser.PhoneNumber.Trim(); txtUserDataPhone.Text = wcServerAPI.GetUserVariable(wUser.Info.ID, "Profile", "DataNumber", ""); } else { MessageBox.Show("Error accessing the selected user", "WINS Error...", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Dispose(); } } catch (Exception ex) { MessageBox.Show("Unexpected Error occurred" + Environment.NewLine + "Error: " + ex.ToString() + Environment.NewLine + "Message: " + ex.Message, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Dispose(); } return 0; }
private short f_LoadWCUsers() { My.MyApplication.Application.DoEvents(); try { int lngTotal = 0; wcServerAPI.TUser wUser = new wcServerAPI.TUser(); int myX = 0; System.Windows.Forms.ListViewItem Itmx = null; int tID = 0; lngTotal = wcServerAPI.GetTotalUsers(); ////For demo purposes we are just loading ////100 Users in the list if (lngTotal > 100) { lngTotal = 100; } lvwUsers.Items.Clear(); if (lngTotal > 0) { pbUsers.Maximum = lngTotal; if (wcServerAPI.GetFirstUser(wcServerAPI.UserLastNameKey, ref wUser, ref tID)) { pbUsers.Value = pbUsers.Value + 1; Itmx = lvwUsers.Items.Add("A-" + wUser.Info.ID.ToString().Trim(), wUser.Info.Name.Trim(), 0); Itmx.SubItems.Add(wUser.Info.ID.ToString().Trim()); Itmx.SubItems.Add(wUser.RealName.Trim()); Itmx.SubItems.Add(wUser.Security[0].SecurityProfile.Trim()); Itmx.SubItems.Add(modBSMiniRPT.DateToDateString(wUser.FirstCall, true).Trim()); Itmx.SubItems.Add(modBSMiniRPT.DateToDateString(wUser.LastCall, true).Trim()); int tempFor1 = lngTotal; for (myX = 2; myX <= tempFor1; myX++) { pbUsers.Value = pbUsers.Value + 1; if (wcServerAPI.GetNextUser(wcServerAPI.UserLastNameKey, ref wUser, ref tID)) { Itmx = lvwUsers.Items.Add("A-" + wUser.Info.ID.ToString().Trim(), wUser.Info.Name.Trim(), 0); Itmx.SubItems.Add(wUser.Info.ID.ToString().Trim()); Itmx.SubItems.Add(wUser.RealName.Trim()); Itmx.SubItems.Add(wUser.Security[0].SecurityProfile.Trim()); Itmx.SubItems.Add(modBSMiniRPT.DateToDateString(wUser.FirstCall, true).Trim()); Itmx.SubItems.Add(modBSMiniRPT.DateToDateString(wUser.LastCall, true).Trim()); } } } else { MessageBox.Show("Error accessing the user database", "User DB Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } pbUsers.Value = 0; } catch (Exception ex) { MessageBox.Show("Unexpected Error occurred" + Environment.NewLine + "Error: " + ex.ToString() + Environment.NewLine + "Message: " + ex.Message, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } My.MyApplication.Application.DoEvents(); return 0; }