public frmExpense(int expenseID) { InitializeComponent(); LoadExpenseHead(); Expense.ExpenseWebService objWebService = new Expense.ExpenseWebService(); ExpenseInfo objInfo = new ExpenseInfo(); objInfo.ExpenseID = expenseID; objInfo = objWebService.ExpenseGetByID(objInfo.ExpenseID, TokenCleintEncrypt.Encrypt(ClientTokenBuilder.BuildTokens())); cmbExpenseType.SelectedValue = objInfo.ExpenseHeadID; txtCost.Text = objInfo.Expense.ToString(); rchtxtNote.Text = objInfo.Note; lblExpenseID.Text = objInfo.ExpenseID.ToString(); lblExpenseHeadID.Text = objInfo.ExpenseHeadID.ToString(); }
private void btnSave_Click(object sender, EventArgs e) { try { if (ValidateForm()) { Expense.ExpenseWebService objWebService = new Expense.ExpenseWebService(); ExpenseInfo objInfo = new ExpenseInfo(); objInfo.ExpenseHeadID = Convert.ToInt32(cmbExpenseType.SelectedValue); objInfo.Expense = Convert.ToDecimal(txtCost.Text); objInfo.Note = rchtxtNote.Text; int expenseID = Convert.ToInt32(lblExpenseID.Text); int expenseHeadID = objInfo.ExpenseHeadID; if (expenseHeadID != 0 && expenseID == 0) { objInfo.AddedBy = GetLoginUser.UserName; objWebService.ExpenseAdd(objInfo, TokenCleintEncrypt.Encrypt(ClientTokenBuilder.BuildTokens())); MessageBox.Show("Data saved successfully"); } else if (expenseHeadID != 0 && expenseID != 0) { objInfo.ExpenseHeadID = expenseHeadID; objInfo.ExpenseID = expenseID; objInfo.EditedBy = GetLoginUser.UserName; objInfo.EditedDate = DateTime.Now; objWebService.ExpenseUpdate(objInfo, TokenCleintEncrypt.Encrypt(ClientTokenBuilder.BuildTokens())); MessageBox.Show("Data updated successfully"); } ClearField(); this.DialogResult = DialogResult.OK; } } catch (Exception ex) { throw ex; } }
/// <remarks/> public void ExpenseUpdateAsync(ExpenseInfo objInfo, string token, object userState) { if ((this.ExpenseUpdateOperationCompleted == null)) { this.ExpenseUpdateOperationCompleted = new System.Threading.SendOrPostCallback(this.OnExpenseUpdateOperationCompleted); } this.InvokeAsync("ExpenseUpdate", new object[] { objInfo, token}, this.ExpenseUpdateOperationCompleted, userState); }
/// <remarks/> public void ExpenseUpdateAsync(ExpenseInfo objInfo, string token) { this.ExpenseUpdateAsync(objInfo, token, null); }
public void ExpenseUpdate(ExpenseInfo objInfo, string token) { this.Invoke("ExpenseUpdate", new object[] { objInfo, token}); }