public bool Update(long tid, ClientRecordModel tentity) { var success = false; if (tentity != null && tid != 0) { using (var scope = new TransactionScope()) { var oldrecord = _unitOfWork.ClientRecordRepository.GetByID(tid); if (oldrecord != null) { oldrecord.businessname = tentity.businessname; oldrecord.clientaddress = tentity.clientaddress; oldrecord.clientemail = tentity.clientemail; oldrecord.clientname = tentity.clientname; oldrecord.contactmobile = tentity.contactmobile; oldrecord.formodule = tentity.formodule; oldrecord.productid = tentity.productid; oldrecord.productname = tentity.productname; oldrecord.userrole = tentity.userrole; oldrecord.userblocked = tentity.userblocked; oldrecord.expirydate = tentity.expirydate; oldrecord.upassword = tentity.upassword + salt; oldrecord.remarks = tentity.remarks; _unitOfWork.ClientRecordRepository.Update(oldrecord); _unitOfWork.Save(); scope.Complete(); success = true; } } } return(success); }
public long Create(ClientRecordModel tentity) { using (var scope = new TransactionScope()) { var NewRecord = new ta_ussbk_clientrecord { businessname = tentity.businessname, clientaddress = tentity.clientaddress, clientemail = tentity.clientemail, clientname = tentity.clientname, contactmobile = tentity.contactmobile, formodule = tentity.formodule, productid = tentity.productid, productname = tentity.productname, userrole = tentity.userrole, userblocked = tentity.userblocked, expirydate = tentity.expirydate, remarks = tentity.remarks, }; _unitOfWork.ClientRecordRepository.Insert(NewRecord); _unitOfWork.Save(); scope.Complete(); return(NewRecord.recordid); } }
public ActionResult Save(ClientRecordModel input, string[] forwebsite) { bool status = false; if (ModelState.IsValid) { if (input.recordid > 0) { input.formodule = forwebsite != null?StringArrayToString(forwebsite) : null; var olddata = _mainobj.GetById(input.recordid); olddata.businessname = input.businessname; olddata.clientaddress = input.clientaddress; olddata.clientemail = input.clientemail.Trim(); olddata.clientname = input.clientname; olddata.contactmobile = input.contactmobile.Trim(); olddata.formodule = input.formodule; olddata.productid = input.productid; olddata.productname = input.productname; olddata.userblocked = input.userblocked; olddata.expirydate = input.expirydate; olddata.remarks = input.remarks; //input.formodule = forwebsite != null ? StringArrayToString(forwebsite) : null; var result = _mainobj.Update(input.recordid, olddata); status = true; return(new JsonResult { Data = new { status = status, message = "User record Updated" } }); } else { var clientrecord = _mainobj.GetByMobile(input.contactmobile); if (clientrecord != null) { return(new JsonResult { Data = new { status = status, error = "Mobile number already existed." } }); } input.userrole = "Client"; input.formodule = forwebsite != null?StringArrayToString(forwebsite) : null; var result = _mainobj.Create(input); status = true; return(new JsonResult { Data = new { status = status, message = "User record inserted" } }); } } return(new JsonResult { Data = new { status = status } }); }
public static ClientRecordModel ClientRecordMapper(ta_ussbk_clientrecord tentity) { var resultl = new ClientRecordModel { businessname = tentity.businessname, clientaddress = tentity.clientaddress, clientemail = tentity.clientemail, clientname = tentity.clientname, contactmobile = tentity.contactmobile, formodule = tentity.formodule, productid = tentity.productid, productname = tentity.productname, recordid = tentity.recordid, userrole = tentity.userrole, userblocked = tentity.userblocked.Value, expirydate = tentity.expirydate, upassword = tentity.upassword, remarks = tentity.remarks, }; return(resultl); }
private void CalculateDataOKBTN_Click(object sender, EventArgs e) { if (NameOfClientTXT.Text == "") { MessageBox.Show("Please enter a name.", "Client Receipt", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (TherapistListCB.Text == "") { MessageBox.Show("Please assign a therapist.", "Client Receipt", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (TotalLBL.Text == "0") { MessageBox.Show("Please select at least one(1) service.", "Client Receipt", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } ClientRecordModel client = new ClientRecordModel { // Client Info SeriesNumber = SeriesNumberLBL.Text, NameOfClient = NameOfClientTXT.Text, TherapistAssigned = TherapistListCB.Text.Trim(), Date = DateLBL.Text, Time = TimeLBL.Text, SeniorCitizen = SCYesRB.Checked == true?SCYesRB.Checked.ToString() : SCYesRB.Checked.ToString(), // Manhattan Experience MEQty1 = MEQtyMaskedTextBox1.Text, MEAmount1 = MEAmount1LBL.Text, MEQty2 = MEQtyMaskedTextBox2.Text, MEAmount2 = MEAmount2LBL.Text, MEQty3 = MEQtyMaskedTextBox3.Text, MEAmount3 = MEAmount3LBL.Text, // UN UNMWQty1 = UNMWQtyMaskedTextBox1.Text, UNMWAmount1 = UNMWAmount1LBL.Text, UNMWQty2 = UNMWQtyMaskedTextBox2.Text, UNMWAmount2 = UNMWAmount2LBL.Text, // NY NYFPQty1 = NYFDQtyMaskedTextBox1.Text, NYFPAmount1 = NYFDAmount1LBL.Text, NYFPQty2 = NYFDQtyMaskedTextBox2.Text, NYFPAmount2 = NYFDAmount2LBL.Text, NYFPQty3 = NYFDQtyMaskedTextBox3.Text, NYFPAmount3 = NYFDAmount3LBL.Text, NYFPQty4 = NYFDQtyMaskedTextBox4.Text, NYFPAmount4 = NYFDAmount4LBL.Text, // JAI JAIQty1 = JAIQtyMaskedTextBox1.Text, JAIAmount1 = JAIAmount1LBL.Text, JAIQty2 = JAIQtyMaskedTextBox2.Text, JAIAmount2 = JAIAmount2LBL.Text, // Duration DRTNQty1 = DRTNQtyMaskedTextBox1.Text, DRTNAmount1 = DRTNAmount1LBL.Text, DRTNQty2 = DRTNQtyMaskedTextBox2.Text, DRTNAmount2 = DRTNAmount2LBL.Text, DRTNQty3 = DRTNQtyMaskedTextBox3.Text, DRTNAmount3 = DRTNAmount3LBL.Text, DRTNQty4 = DRTNQtyMaskedTextBox4.Text, DRTNAmount4 = DRTNAmount4LBL.Text, // Medium MDQty1 = MDQtyMaskedTextBox1.Text, MDAmount1 = MDAmount1LBL.Text, MDQty2 = MDQtyMaskedTextBox2.Text, MDAmount2 = MDAmount2LBL.Text, MDQty3 = MDQtyMaskedTextBox3.Text, MDAmount3 = MDAmount3LBL.Text, MDQty4 = MDQtyMaskedTextBox4.Text, MDAmount4 = MDAmount4LBL.Text, MDQty5 = MDQtyMaskedTextBox5.Text, MDAmount5 = MDAmount5LBL.Text, MDQty6 = MDQtyMaskedTextBox6.Text, MDAmount6 = MDAmount6LBL.Text, // Pressure PRQty1 = PRQtyMaskedTextBox1.Text, PRAmount1 = PRAmount1LBL.Text, PRQty2 = PRQtyMaskedTextBox2.Text, PRAmount2 = PRAmount2LBL.Text, PRQty3 = PRQtyMaskedTextBox3.Text, PRAmount3 = PRAmount3LBL.Text, // Additional Time ATQty1 = ATQtyMaskedTextBox1.Text, ATAmount1 = ATAmount1LBL.Text, ATQty2 = ATQtyMaskedTextBox2.Text, ATAmount2 = ATAmount2LBL.Text, // Total Total = TotalLBL.Text, NetOfVAT = NetOfVATLBL.Text, VAT = VatLBL.Text, SeniorCitizenDiscount = SeniorCDiscountLBL.Text, TotalAmountDue = TotalAmountDLBL.Text, Void = "FALSE" }; DatabaseClass.SaveClientRecord(client); MessageBox.Show("Client Name '" + NameOfClientTXT.Text + "' with Series Number '" + SeriesNumberLBL.Text + "' was successfully saved.", "Client Receipt", MessageBoxButtons.OK, MessageBoxIcon.Information); RefreshClient(); }