protected void btn_update_Click(object sender, EventArgs e) { ds_analytics.m_labsRow lab_row = ((ds_analytics.m_labsRow)(ViewState["lab_row"])); lab_row.labname = tb_labname.Text; lab_row.address = tb_address.Text; lab_row.city = tb_city.Text; lab_row.labtype = tb_type.Text; lab_row.auditstatus = tb_auditstatus.Text; lab_row.fax = tb_fax.Text; lab_row.contact_person = tb_cp1.Text; lab_row.key_acc_person = tb_cp2.Text; lab_row.email1 = tb_email1.Text; lab_row.email2 = tb_email2.Text; lab_row.mbl1 = tb_mbl1.Text; lab_row.mbl2 = tb_mbl2.Text; lab_row.phn1 = tb_phn1.Text; lab_row.phn2 = tb_phn2.Text; lab_row.isactive = cb_isactive.Checked; m_labs.update(m_labs.GetLabRowWithNull(lab_row)); ds_analytics.m_labsDataTable lab_dt = m_labs.getAllLabs(); gv_labs.DataSource = lab_dt; gv_labs.DataBind(); ViewState["dtStored"] = lab_dt; Reset(); }
protected void btn_add_Click(object sender, EventArgs e) { try { ds_analytics.m_labsDataTable lab_dt = new ds_analytics.m_labsDataTable(); ds_analytics.m_labsRow lab_row = lab_dt.Newm_labsRow(); lab_row.labname = tb_labname.Text; lab_row.address = tb_address.Text; lab_row.city = tb_city.Text; lab_row.labtype = tb_type.Text; lab_row.auditstatus = tb_auditstatus.Text; lab_row.fax = tb_fax.Text; lab_row.contact_person = tb_cp1.Text; lab_row.key_acc_person = tb_cp2.Text; lab_row.email1 = tb_email1.Text; lab_row.email2 = tb_email2.Text; lab_row.mbl1 = tb_mbl1.Text; lab_row.mbl2 = tb_mbl2.Text; lab_row.phn1 = tb_phn1.Text; lab_row.phn2 = tb_phn2.Text; lab_row.isactive = cb_isactive.Checked; lab_row = m_labs.GetLabRowWithNull(lab_row); m_labs.insert(lab_row); string url = "labs.aspx"; ClientScript.RegisterStartupScript(this.GetType(), "callfunction", "alert('Record Added Successfully.');window.location.href = '" + url + "';", true); } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "error", "<script>alert('Error in adding record.');</script>"); } }
private void load_lab() { lbl_date.Text = DateTime.Now.ToString("dd/MM/yyyy"); ds_analytics.m_labsRow lab_row = m_labs.getLabByLabid(labid)[0]; lbl_lab.Text = "To," + "</br>" + lab_row.contact_person + ",</br>" + lab_row.labname + ",</br>" + lab_row.address + ",</br>" + lab_row.city + ",</br>" + "Phone: " + lab_row.phn1 + ",</br>" + "Email: " + lab_row.email1; }
private void load_lab() { lbl_date.Text = DateTime.Now.ToString("dd/MM/yyyy"); lbl_refno.Text = projects.getProjectByPrjid(requests.getRequestbyReqid(reqid)[0].projectid)[0].projectname.Substring(0, 3) + reqid; //First three letters of project name + reqid ds_analytics.m_labsRow lab_row = m_labs.getLabByLabid(labid)[0]; lbl_lab.Text = "To," + "</br>" + lab_row.contact_person + ",</br>" + lab_row.labname + ",</br>" + lab_row.address + ",</br>" + lab_row.city + ",</br>" + "Phone: " + lab_row.phn1 + ",</br>" + "Email: " + lab_row.email1; lbl_labmanager.Text = lab_row.contact_person; }
protected void dd_lab_DataBound(object sender, EventArgs e) { //adding address of labs as title DropDownList ddl = (DropDownList)sender; foreach (ListItem li in ddl.Items) { ds_analytics.m_labsRow m_labs_row = m_labs.getLabByLabid(Convert.ToInt64(li.Value))[0]; li.Attributes.Add("title", m_labs_row.address); } }
protected void mail_to_lab(long labid) { string sub = "GSK: Samples for tests at your lab"; string from; ds_analytics.m_usersRow receiver_row = m_users.getUserByUserid(req_row.responsible)[0]; if (receiver_row.email != "") { from = receiver_row.email; } else { from = "*****@*****.**"; } WebClient wclient = new WebClient(); string url = HttpContext.Current.Request.Url.AbsoluteUri; url = url.Replace("UI/users/reqaction.aspx", "Mailer/reqlab.htm"); string pagedata = wclient.DownloadString(url); string body = pagedata; string[] to = new string[2]; string[] cc = new string[2]; string[] bcc = new string[2]; //mail to lab ds_analytics.m_labsRow lab_row = m_labs.getLabByLabid(labid)[0]; if (!lab_row.Isemail1Null() || !lab_row.Isemail2Null()) { if (!lab_row.Isemail1Null() && !lab_row.Isemail2Null()) { //notnull && notnull body = body.Replace("!!~lab_manager~!!", lab_row.contact_person); to[0] = lab_row.email1; cc[0] = lab_row.email2; } else if (!lab_row.Isemail1Null() && lab_row.Isemail2Null()) { //notnull && null body = body.Replace("!!~lab_manager~!!", lab_row.contact_person); to[0] = lab_row.email1; } else if (lab_row.Isemail1Null() && !lab_row.Isemail2Null()) { //null && notnull body = body.Replace("!!~lab_manager~!!", lab_row.key_acc_person); to[0] = lab_row.email2; } analyticsmail ana_mail = new analyticsmail(); ana_mail.sendmails(to, cc, bcc, from, sub, body, ""); } }
public static int insert(ds_analytics.m_labsRow lab_row) { return(Adapter.Insert(lab_row.labname, lab_row.address, lab_row.city, lab_row.labtype, lab_row.auditstatus, lab_row.contact_person, lab_row.key_acc_person, lab_row.mbl1, lab_row.mbl2, lab_row.email1, lab_row.email2, lab_row.phn1, lab_row.phn2, lab_row.fax, lab_row.isactive )); }
protected void Page_Load(object sender, EventArgs e) { Encryption64 e64 = new Encryption64(); reqid = e64.Decrypt(Request.QueryString.Get("reqid").Replace(" ", "+")); labid = Convert.ToInt64(e64.Decrypt(Request.QueryString.Get("labid").Replace(" ", "+"))); req_reference = projects.getProjectByPrjid(requests.getRequestbyReqid(reqid)[0].projectid)[0].projectname.Substring(0, 3) + reqid; //First three letters of project name + reqid if (!IsPostBack) { DataTable dt_SampleTestLab = labresult.getSampleTestLabByJoining(reqid); //1 - Filter for only selected lab DataRow[] d_rows = dt_SampleTestLab.Select("labid = '" + labid.ToString() + "'"); DataTable dt_SampleTestLab_filtered = dt_SampleTestLab.Clone(); foreach (DataRow dr in d_rows) { dt_SampleTestLab_filtered.ImportRow(dr); } //2 - Finding Unique Samples DataView view = new DataView(dt_SampleTestLab_filtered); dt_SampleTestLab_filtered = view.ToTable(true, "sampleid", "sample_quantity"); //3 - Bind Repeater Repeater1.DataSource = dt_SampleTestLab_filtered; Repeater1.DataBind(); //4 - Bind Lab Address etc. ds_analytics.m_labsRow lab_row = m_labs.getLabByLabid(labid)[0]; lbl_name1.Text = lab_row.contact_person; lbl_name2.Text = lab_row.key_acc_person; lbl_lab_name.Text = lab_row.labname; lbl_lab_add.Text = lab_row.address; lbl_lab_city.Text = lab_row.city; lbl_email1.Text = lab_row.email1; lbl_mbl1.Text = lab_row.mbl1; lbl_phn1.Text = lab_row.phn1; //5 - Auto Print Pop-up Page.ClientScript.RegisterStartupScript(this.GetType(), "Print", "javascript:window.print();", true); } }
protected void imgbtn_Edit_Click(object sender, ImageClickEventArgs e) { GridViewRow gv_row = (GridViewRow)((sender as ImageButton).NamingContainer); long labid = Convert.ToInt64(gv_labs.DataKeys[gv_row.RowIndex].Value); ds_analytics.m_labsDataTable thislab_dt = m_labs.getLabByLabid(labid); if (thislab_dt.Rows.Count > 0) { ds_analytics.m_labsRow lab_row = thislab_dt[0]; tb_labname.Text = lab_row.labname; tb_address.Text = lab_row.address; tb_city.Text = lab_row.city; tb_type.Text = lab_row.labtype; tb_auditstatus.Text = lab_row.auditstatus; tb_fax.Text = lab_row.fax; tb_cp1.Text = lab_row.contact_person; tb_cp2.Text = lab_row.key_acc_person; tb_email1.Text = lab_row.email1; tb_email2.Text = lab_row.email2; tb_mbl1.Text = lab_row.mbl1; tb_mbl2.Text = lab_row.mbl2; tb_phn1.Text = lab_row.phn1; tb_phn2.Text = lab_row.phn2; cb_isactive.Checked = lab_row.isactive; ViewState["lab_row"] = lab_row; btn_add.Visible = false; btn_update.Visible = true; btn_cancel.Visible = true; } else { ClientScript.RegisterStartupScript(this.GetType(), "error", "<script>alert('Error in getting Lab details.');</script>"); } }
public static ds_analytics.m_labsRow GetLabRowWithNull(ds_analytics.m_labsRow lab_row) { if (lab_row.labname == null || lab_row.labname == "") { lab_row.SetlabnameNull(); } if (lab_row.address == null || lab_row.address == "") { lab_row.SetaddressNull(); } if (lab_row.city == null || lab_row.city == "") { lab_row.SetcityNull(); } if (lab_row.labtype == null || lab_row.labtype == "") { lab_row.SetlabtypeNull(); } if (lab_row.auditstatus == null || lab_row.auditstatus == "") { lab_row.SetauditstatusNull(); } if (lab_row.fax == null || lab_row.fax == "") { lab_row.SetfaxNull(); } if (lab_row.contact_person == null || lab_row.contact_person == "") { lab_row.Setcontact_personNull(); } if (lab_row.key_acc_person == null || lab_row.key_acc_person == "") { lab_row.Setkey_acc_personNull(); } if (lab_row.email1 == null || lab_row.email1 == "") { lab_row.Setemail1Null(); } if (lab_row.email2 == null || lab_row.email2 == "") { lab_row.Setemail2Null(); } if (lab_row.mbl1 == "" || lab_row.mbl1 == "") { lab_row.Setmbl1Null(); } if (lab_row.mbl2 == "" || lab_row.mbl2 == "") { lab_row.Setmbl2Null(); } if (lab_row.phn1 == null || lab_row.phn1 == "") { lab_row.Setphn1Null(); } if (lab_row.phn2 == null || lab_row.phn2 == "") { lab_row.Setphn2Null(); } return(lab_row); }
public static int update(ds_analytics.m_labsRow lab_row) { return(Adapter.Update(lab_row)); }