private void ClearFields() { try { txtAccountID.Text = objDAL.getNextNo(cboAccountType.Text).ToString(); txtAccountTitle.Text = string.Empty; //cboAccountType.SelectedIndex = 0; txtFilter.Text = string.Empty; txtFilter.Enabled = false; cboAccountTypeFilter.Enabled = false; cboAccountTypeFilter.SelectedItem = cboAccountType.SelectedItem; cboAccountType.Enabled = true; this.txtOpDebit.Text = "0"; this.txtOpCredit.Text = "0"; txtAccountTitle.Focus(); LoadGrid(); vOpenMode = false; Grid.Enabled = false; } catch (Exception exc) { Message.ShowMessage(MyMessages.MessageType.Error, exc.Message); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (txtName.Text.Trim() == string.Empty) { Message.ShowMessage(MyMessages.MessageType.MissingInfo, "Please Enter Party Name."); txtName.Focus(); return; } Objects.ShareMembers obj = new Objects.ShareMembers(); obj.MemberID = Int64.Parse(txtID.Text); obj.RegistrationDate = dtRegisterDate.Value; obj.MemberName = txtName.Text.Trim(); obj.FatherName = txtFatherName.Text.Trim(); obj.ContactNo = txtContactNo.Text.Trim(); obj.CNINCNo = txtCNIC.Text.Trim(); obj.Occupation = txtOccupation.Text.Trim(); obj.VillageName = txtVillage.Text.Trim(); obj.CityName = txtCity.Text.Trim(); obj.PostalAddress = txtAddress.Text.Trim(); obj.PropertDetail = txtPropertyDetail.Text.Trim(); obj.Remarks = txtRemarks.Text.Trim(); obj.AccountNo = txtID.Tag.ToString(); if (imgLogo.Image != null) { MemoryStream ms = new MemoryStream(); imgLogo.Image.Save(ms, imgLogo.Image.RawFormat); byte[] arrayImage = ms.GetBuffer(); obj.MemberPic = arrayImage; } //Insert Account var AccDAL = new DAL.AccountChart(); AccDAL.connectionstring = objDAL.connectionstring; if (!vOpenMode) { Objects.AccountChart objAcc = new Objects.AccountChart(); objAcc.AccountNo = AccDAL.getNextNo("ASSET").ToString(); objAcc.AccountTitle = obj.MemberName; objAcc.AccountType = "ASSET"; objAcc.AccountSubType = "Member"; objAcc.IsParty = true; objAcc.IsBank = false; objAcc.OpeningDebit = 0; objAcc.OpeningCredit = 0; AccDAL.InsertRecord(objAcc); //Insert //obj.MemberID = objDAL.getNextNo(); obj.AccountNo = objAcc.AccountNo; objDAL.InsertRecord(obj); } else { // UPdate Account Objects.AccountChart objAcc = new Objects.AccountChart(); objAcc.AccountNo = obj.AccountNo; objAcc.AccountTitle = obj.MemberName; objAcc.AccountType = "ASSET"; objAcc.AccountSubType = "Member"; objAcc.IsParty = true; objAcc.IsBank = false; objAcc.OpeningDebit = 0; objAcc.OpeningCredit = 0; AccDAL.UpdateRecord(objAcc); objDAL.UpdateRecord(obj); } Message.ShowMessage(MyMessages.MessageType.SaveRecord); LoadGrid(); btnClear_Click(sender, e); } catch (Exception exc) { Message.ShowMessage(MyMessages.MessageType.Error, exc.Message); } }
private void btnSave_Click(object sender, EventArgs e) { try { string vMessage = string.Empty; if (txtName.Text.Trim() == string.Empty) { Message.ShowMessage(MyMessages.MessageType.MissingInfo, "Please Enter Account Title."); txtName.Focus(); return; } Objects.BankAccounts obj = new Objects.BankAccounts(); obj.BankAccountID = int.Parse(txtID.Text); obj.AccountTitle = txtName.Text.Trim(); obj.BankName = txtBankName.Text.Trim(); obj.BranchName = txtBranchName.Text.Trim(); obj.BranchCode = txtBranchCode.Text.Trim(); obj.AccountID = txtID.Tag.ToString(); decimal vOpDebit = 0; decimal vOpCredit = 0; decimal.TryParse(this.txtOpDebit.Text, out vOpDebit); decimal.TryParse(this.txtOpCredit.Text, out vOpCredit); var AccDAL = new DAL.AccountChart(); AccDAL.connectionstring = objDAL.connectionstring; Objects.AccountChart objAcc = new Objects.AccountChart(); objAcc.AccountNo = obj.AccountID; objAcc.AccountTitle = obj.AccountTitle; objAcc.AccountType = "ASSET"; objAcc.AccountSubType = "Banks"; objAcc.IsParty = false; objAcc.IsBank = true; objAcc.OpeningDebit = vOpDebit; objAcc.OpeningCredit = vOpCredit; if (!vOpenMode) { //Insert Account objAcc.AccountNo = AccDAL.getNextNo("ASSET").ToString(); AccDAL.InsertRecord(objAcc); //Insert Bank Account obj.BankAccountID = int.Parse(objDAL.getNextNo().ToString()); obj.AccountID = objAcc.AccountNo; objDAL.InsertRecord(obj); } else { AccDAL.UpdateRecord(objAcc); objDAL.UpdateRecord(obj); } Message.ShowMessage(MyMessages.MessageType.SaveRecord); LoadGrid(); btnClear_Click(sender, e); } catch (Exception exc) { Message.ShowMessage(MyMessages.MessageType.Error, exc.Message); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (txtName.Text.Trim() == string.Empty) { Message.ShowMessage(MyMessages.MessageType.MissingInfo, "Please Enter Party Name."); txtName.Focus(); return; } Objects.Parties obj = new Objects.Parties(); obj.PartyID = Int64.Parse(txtID.Text); obj.PartyName = txtName.Text.Trim(); obj.ContactNo = txtContactNo.Text.Trim(); obj.CNICNo = txtCNIC.Text.Trim(); obj.City = txtCity.Text.Trim(); obj.Address = txtAddress.Text.Trim(); obj.Email = txtEmail.Text.Trim(); obj.Web = txtWeb.Text.Trim(); obj.NTN = txtNTN.Text.Trim(); obj.AccountID = txtID.Tag.ToString(); obj.IsSupplier = chkSupplier.Checked; obj.IsCustomer = chkCustomer.Checked; decimal vOpDebit = 0; decimal vOpCredit = 0; decimal.TryParse(this.txtOpDebit.Text, out vOpDebit); decimal.TryParse(this.txtOpCredit.Text, out vOpCredit); //Insert Account var AccDAL = new DAL.AccountChart(); AccDAL.connectionstring = objDAL.connectionstring; Objects.AccountChart objAcc = new Objects.AccountChart(); if (!string.IsNullOrEmpty(txtID.Tag.ToString())) { objAcc.AccountNo = txtID.Tag.ToString(); } objAcc.AccountTitle = obj.PartyName; objAcc.AccountType = "ASSET"; objAcc.AccountSubType = "Parties"; objAcc.IsParty = true; objAcc.IsBank = false; objAcc.OpeningDebit = vOpDebit; objAcc.OpeningCredit = vOpCredit; if (!vOpenMode) { objAcc.AccountNo = AccDAL.getNextNo("ASSET").ToString(); AccDAL.InsertRecord(objAcc); //Insert Party obj.PartyID = objDAL.getNextNo(); obj.AccountID = objAcc.AccountNo; objDAL.InsertRecord(obj); } else { // UPdate Opeinig in Account AccDAL.UpdateRecord(objAcc); objDAL.UpdateRecord(obj); } Message.ShowMessage(MyMessages.MessageType.SaveRecord); LoadGrid(); btnClear_Click(sender, e); } catch (Exception exc) { Message.ShowMessage(MyMessages.MessageType.Error, exc.Message); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (txtName.Text.Trim() == string.Empty) { Message.ShowMessage(MyMessages.MessageType.MissingInfo, "Please Enter Name."); txtName.Focus(); return; } int vDeptID, vDesgID, vShiftID; if (cboDepartment.SelectedIndex != -1) { int.TryParse(cboDepartment.SelectedValue.ToString(), out vDeptID); } else { Message.ShowMessage(MyMessages.MessageType.MissingInfo, "Please Select Department."); cboDepartment.Focus(); return; } if (cboDesignation.SelectedIndex != -1) { int.TryParse(cboDesignation.SelectedValue.ToString(), out vDesgID); } else { Message.ShowMessage(MyMessages.MessageType.MissingInfo, "Please Select Designation."); cboDesignation.Focus(); return; } if (cboShift.SelectedIndex != -1) { int.TryParse(cboShift.SelectedValue.ToString(), out vShiftID); } else { Message.ShowMessage(MyMessages.MessageType.MissingInfo, "Please Select Shift."); cboShift.Focus(); return; } decimal vBasicSalary = 0; decimal.TryParse(txtBasicSalary.Text, out vBasicSalary); Objects.Employees obj = new Objects.Employees(); obj.EmployeeID = Int32.Parse(txtID.Text); obj.EmployeeName = txtName.Text.Trim(); obj.FatherName = txtFatherName.Text.Trim(); obj.CNIC = txtCNIC.Text.Trim(); obj.ContactNo = txtContactNo.Text.Trim(); obj.DepartmentID = vDeptID; obj.DesignationID = vDesgID; obj.ShiftID = vShiftID; obj.JoiningDate = dtJoiningDate.Value; obj.BasicSalary = vBasicSalary; obj.Address = txtAddress.Text.Trim(); obj.AccountNo = txtID.Tag.ToString(); obj.InActive = chkInActive.Checked; obj.IsSalesman = chkSalesman.Checked; obj.UserID = vUserID; //Insert Account var AccDAL = new DAL.AccountChart(); AccDAL.connectionstring = objDAL.connectionstring; Objects.AccountChart objAcc = new Objects.AccountChart(); objAcc.AccountNo = obj.AccountNo; objAcc.AccountTitle = obj.EmployeeName; objAcc.AccountType = "LIABILITY"; objAcc.AccountSubType = "Employee"; objAcc.IsParty = false; objAcc.IsBank = false; objAcc.OpeningDebit = 0; objAcc.OpeningCredit = 0; if (!vOpenMode) { objAcc.AccountNo = AccDAL.getNextNo("LIABILITY").ToString(); AccDAL.InsertRecord(objAcc); //Insert Party obj.EmployeeID = objDAL.getNextNo(); obj.AccountNo = objAcc.AccountNo; objDAL.InsertRecord(obj); } else { if (!string.IsNullOrEmpty(objAcc.AccountNo)) { // UPdate Account AccDAL.UpdateRecord(objAcc); } else { objAcc.AccountNo = AccDAL.getNextNo("LIABILITY").ToString(); AccDAL.InsertRecord(objAcc); obj.AccountNo = objAcc.AccountNo; } objDAL.UpdateRecord(obj); } Message.ShowMessage(MyMessages.MessageType.SaveRecord); LoadGrid(); btnClear_Click(sender, e); } catch (Exception exc) { Message.ShowMessage(MyMessages.MessageType.Error, exc.Message); } }