예제 #1
0
 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();
 }
예제 #2
0
        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;
            }
        }
예제 #3
0
 /// <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);
 }
예제 #4
0
 /// <remarks/>
 public void ExpenseUpdateAsync(ExpenseInfo objInfo, string token) {
     this.ExpenseUpdateAsync(objInfo, token, null);
 }
예제 #5
0
 public void ExpenseUpdate(ExpenseInfo objInfo, string token) {
     this.Invoke("ExpenseUpdate", new object[] {
                 objInfo,
                 token});
 }