private void btndel_Click(object sender, EventArgs e) { string sdelrcid = this.txtrciddel.Text; if (sdelrcid == "") { MessageBox.Show("Pleae fill up receipt id !"); } else { try { int delrcid = int.Parse(this.txtrciddel.Text); Operatedbclass opdb = new Operatedbclass(); if (opdb.Detecrcid(delrcid) == "") { MessageBox.Show("Receipt id not exist."); } else { opdb.Deletercid(delrcid); MessageBox.Show("Receipt " + sdelrcid + " delete successful !"); this.txtrciddel.Text = ""; } } catch (Exception ex) { MessageBox.Show("Some error happened " + ex.Message + ""); } } }
private void Insuranceservicesform_Load(object sender, EventArgs e) { Operatedbclass opdt = new Operatedbclass(); opdt.initdtbind(this.dtgvis, "Insinfos"); this.Initdgvh(); Setdgvso(this.dtgvis); cominstype.Enabled = false; comclaimfp.Enabled = false; }
private void btnupdate_Click(object sender, EventArgs e) { if ((this.txtcarplate.Text == "") || (this.txtcarv.Text == "") || (this.labname.Text == ".") || (this.labphone.Text == ".")) { MessageBox.Show("Please Fillup information !"); } else { Operatedbclass opdb = new Operatedbclass(); opdb.Updatecusinfo(this.labname.Text, this.txtcarplate.Text, this.labphone.Text, int.Parse(this.txtcarv.Text)); MessageBox.Show("Update successful !"); cleanup(); } }
private void btnsubmit_Click(object sender, EventArgs e) { string acc, pass, actype, repass, countnum; acc = this.txtacc.Text; pass = this.txtpass.Text; repass = this.txtcpass.Text; actype = this.combacty.Text.Trim(); countnum = "0"; if ((acc == "") || (pass == "") || (repass == "") || (actype == "")) { MessageBox.Show("Please Fillup information !"); } else { try { Staffinfos stinfo = new Staffinfos(actype, acc, repass); Operatedbclass opdb = new Operatedbclass(); if (pass.Equals(repass)) { if (opdb.Matchaccount(stinfo.Staccount) != countnum) { MessageBox.Show("Account already exist. Please use another one."); } else { opdb.Insertloinfo(stinfo.Actype, stinfo.Staccount, stinfo.Stpass); MessageBox.Show("Register successful !"); cleanup(); } } else { MessageBox.Show("Password doesn't match with the confirm password !"); } } catch (Exception ex) { MessageBox.Show("Some error happened " + ex.Message + ""); } } }
private void btnsubmit_Click(object sender, EventArgs e) { Randomidclass rand = new Randomidclass(); int trcid = rand.genrandid(); string tcusname = this.labname.Text; string tcarnum = this.labcarplate.Text; string tcusphone = this.labphonenum.Text; string tinstype = this.cominstype.Text; string tfayear = this.comclaimfp.Text; string tncd = this.labncd.Text; string tyy = this.txtyy.Text; string tmm = this.txtmm.Text; string tdd = this.txtdd.Text; string tstdate = tyy + "-" + tmm + "-" + tdd; if ((tinstype == "") || (tfayear == "") || (tyy == "") || (tmm == "") || (tdd == "") || (tncd == ".")) { MessageBox.Show("Please Fillup information !"); } else { try { string tendyy = (int.Parse(tyy) + 1).ToString(); string tenddate = tendyy + "-" + tmm + "-" + tdd; int tcarv = int.Parse(this.labcarval.Text); Operatedbclass opdb = new Operatedbclass(); Insurancedetails insd = new Insurancedetails(trcid, tcusname, tcarnum, tcusphone, tcarv, tinstype, tfayear, tncd, glbsum, tstdate, tenddate); opdb.Insertinsrecord(insd.Rcid, insd.Cusname, insd.Carnum, insd.Cusphone, insd.Carprice, insd.Instype, insd.Fayear, insd.Ncd, insd.Sum, insd.Stdate, insd.Enddate); MessageBox.Show("Submit successful! Please research to view record."); cleanup(); } catch (Exception ex) { MessageBox.Show("Some error happened " + ex.Message + ""); } } }
private void btnsearch_Click(object sender, EventArgs e) { string usphone = this.txtsp.Text; if (usphone == "") { MessageBox.Show("Phone number empty !"); } else { Operatedbclass opdb = new Operatedbclass(); //opdb.Detecphone(usphone); string detectph = ""; SqlConnection sqlconn = opdb.Opendbcn(); sqlconn.Open(); string sql2 = "select* from Cusinsinfo where Cusphone='" + usphone + "'"; SqlCommand cmd2 = new SqlCommand(sql2, sqlconn); SqlDataReader dr = cmd2.ExecuteReader(); if (dr.Read()) { detectph = dr["Cusphone"].ToString(); // if (detectph == usphone) // { cusphone = dr["Cusphone"].ToString(); cusname = dr["Cusname"].ToString(); carnum = dr["Carnum"].ToString(); carprice = dr["Carprice"].ToString(); // } } else { MessageBox.Show("Phone number not exist !"); } sqlconn.Close(); this.labname.Text = cusname; this.labphone.Text = cusphone; this.txtcarplate.Text = carnum; this.txtcarv.Text = carprice; } }
private void btnviewall_Click(object sender, EventArgs e) { string phonenum = this.txtsearchphone.Text; Operatedbclass opdt = new Operatedbclass(); if (phonenum == "") { MessageBox.Show("Phone number empty !"); } else { if (opdt.dtallbind(this.dtgvis, "Insinfos", phonenum) == "") { MessageBox.Show("No record!"); } else { opdt.dtallbind(this.dtgvis, "Insinfos", phonenum); } } }
private void btnsearchphone_Click(object sender, EventArgs e) { string phonenum = this.txtsearchphone.Text; Operatedbclass opdt = new Operatedbclass(); if (phonenum == "") { MessageBox.Show("Phone number empty !"); } else { if (opdt.dtbind(this.dtgvis, "Cusinsinfo", phonenum) == "") { MessageBox.Show("Phone number not exist !"); } else { opdt.dtbind(this.dtgvis, "Cusinsinfo", phonenum); } } }
private void btnsubmit_Click(object sender, EventArgs e) { string tcusname, tcarnum, tcusph, tcarpr, countnum; int tcarpr2; tcusname = this.txtcusname.Text; tcarnum = this.txtcarpn.Text; tcusph = this.txtphonen.Text; tcarpr = this.txtcarp.Text; countnum = "0"; if ((tcusname == "") || (tcarnum == "") || (tcusph == "") || (tcarpr == "")) { MessageBox.Show("Please Fillup information !"); } else { try { tcarpr2 = int.Parse(tcarpr); Customerinfos cusinfosobj = new Customerinfos(tcusname, tcarnum, tcusph, tcarpr2); Operatedbclass operatedb = new Operatedbclass(); if (operatedb.Matchphone(cusinfosobj.Cusphone) != countnum) { MessageBox.Show("Phone number alreay registered !"); } else { operatedb.Insertcusinfo(cusinfosobj.Cusname, cusinfosobj.Carnum, cusinfosobj.Cusphone, cusinfosobj.Carprice); MessageBox.Show("Register successful !"); cleantxtbox(); } } catch (Exception ex) { MessageBox.Show("Some error happened " + ex.Message + ""); } } }
private void btnviewallreceipt_Click(object sender, EventArgs e) { string rcid = this.txtrcid.Text; Operatedbclass opdt = new Operatedbclass(); if (rcid == "") { MessageBox.Show("Receipt id empty !"); } else { int rcidnum = int.Parse(this.txtrcid.Text); if (opdt.dtrcbind(this.dtgvis, "Insinfos", rcidnum) == "") { MessageBox.Show("Receipt id not exist !"); } else { opdt.dtrcbind(this.dtgvis, "Insinfos", rcidnum); } } }
private void btnlogin_Click(object sender, EventArgs e) { string account = this.txtacc.Text; string passd = this.txtpass.Text; if ((account == "") || (passd == "")) { MessageBox.Show("Please enter account or password !"); return; } else { try { Operatedbclass operatedb = new Operatedbclass(); if (operatedb.Finduserpass(account) == passd) { Multselectform multslf = new Multselectform(); multslf.lgusname = account; multslf.lgustype = operatedb.Findusertype(account); multslf.lgtime = DateTime.Now.ToString(); this.Hide(); multslf.ShowDialog(); this.Close(); } else { MessageBox.Show("Password error !"); return; } } catch (Exception ex) { MessageBox.Show("Some error happened " + ex.Message + ""); } } }