protected void SaveAll_Click(object sender, EventArgs e) { int num; if (Session["lt_pwx"] != null) { lt_pwx.Clear(); lt_pwx = (List <pt.Stage>)Session["lt_pwx"]; } if (Session["lt_mix"] != null) { lt_mix.Clear(); lt_mix = (List <pt.PtInfo>)Session["lt_mix"]; c_ptinfo.xID = lt_mix[0].xID; } if (Session["lt_repx"] != null) { lt_repx.Clear(); lt_repx = (List <pt.Representative>)Session["lt_repx"]; c_rep.ID = lt_repx[0].ID; } if (Session["lt_appx"] != null) { lt_appx.Clear(); lt_appx = (List <pt.Applicant>)Session["lt_appx"]; } if (Session["lt_invx"] != null) { lt_invx.Clear(); lt_invx = (List <pt.Inventor>)Session["lt_invx"]; } if (Session["lt_assinfox"] != null) { lt_assinfox.Clear(); lt_assinfox = (List <pt.Assignment_info>)Session["lt_assinfox"]; c_assinfo.ID = lt_assinfox[0].ID; } if (Session["lt_xprix"] != null) { lt_xprix.Clear(); lt_xprix = (List <pt.Priority_info>)Session["lt_xprix"]; c_pri.xID = lt_xprix[0].xID; } SetLatestRowsFromGrid_App_gv(); SetLatestRowsFromGrid_Inv_gv(); c_ptinfo.reg_number = ""; c_ptinfo.xtype = lbl_type.Text; c_ptinfo.title_of_invention = txt_title_of_invention.Text; c_ptinfo.pt_desc = txt_pt_desc.Text; if (lt_pwx.Count > 0) { t.updatePwalletDate(lt_pwx[0].ID, TextBox1.Text); c_ptinfo.log_staff = lt_pwx[0].ID; } c_ptinfo.reg_date = TextBox1.Text; try { lt_mix[0].reg_date = TextBox1.Text; if ((lt_mix[0].reg_date == null) || (c_ptinfo.reg_date == "")) { c_ptinfo.reg_date = xreg_date; } else { c_ptinfo.reg_date = lt_mix[0].reg_date; } } catch (Exception ee) { } c_ptinfo.xvisible = xvisible; c_ptinfo.claim_no = "0"; c_ptinfo.loa_no = "0"; c_ptinfo.pct_no = "0"; c_ptinfo.doa_no = "0"; c_assinfo.date_of_assignment = txt_assignment_date.Text; c_assinfo.assignee_name = txt_assignee_name.Text; c_assinfo.assignee_address = txt_assignee_address.Text; c_assinfo.assignee_nationality = select_assignee_nationality.SelectedValue; c_assinfo.assignor_name = txt_assignor_name.Text; c_assinfo.assignor_address = txt_assignor_address.Text; c_assinfo.assignor_nationality = select_assignor_nationality.SelectedValue; if (lt_pwx.Count > 0) { c_assinfo.log_staff = lt_pwx[0].ID; } c_assinfo.visible = xvisible; c_rep.agent_code = rep_code.Text; c_rep.xname = rep_xname.Text; c_rep.nationality = "160"; c_rep.country = "160"; c_rep.state = select_rep_state.SelectedValue; c_rep.address = txt_rep_address.Text; c_rep.xmobile = txt_rep_telephone.Text; c_rep.xemail = txt_rep_email.Text; c_rep.reg_date = TextBox1.Text; if ((c_rep.reg_date == null) || (c_rep.reg_date == "")) { c_rep.reg_date = xreg_date; } c_rep.visible = xvisible; if (lt_pwx.Count > 0) { c_rep.log_staff = lt_pwx[0].ID; } if (Session["lt_app"] != null) { lt_app = (List <SortedList <string, string> >)Session["lt_app"]; } if (Session["lt_inv"] != null) { lt_inv = (List <SortedList <string, string> >)Session["lt_inv"]; } if (Session["lt_pri"] != null) { lt_pri = (List <SortedList <string, string> >)Session["lt_pri"]; } if (lt_app.Count > 0) { for (num = 0; num < lt_app.Count; num++) { pt.Applicant applicant = new pt.Applicant { xname = lt_app[num]["txt_name_app"], address = lt_app[num]["txt_address_app"], xemail = lt_app[num]["txt_email_app"], xmobile = lt_app[num]["txt_mobile_app"], nationality = lt_app[num]["select_app_nationality"] }; if (Session["log_staff"] != null) { applicant.log_staff = Session["log_staff"].ToString(); } applicant.visible = xvisible; c_app = null; c_app = applicant; lt_xapp.Add(c_app); } } if (lt_inv.Count > 0) { for (num = 0; num < lt_inv.Count; num++) { pt.Inventor inventor = new pt.Inventor { xname = lt_inv[num]["txt_name_inv"], address = lt_inv[num]["txt_address_inv"], xemail = lt_inv[num]["txt_email_inv"], xmobile = lt_inv[num]["txt_mobile_inv"], nationality = lt_inv[num]["select_inv_nationality"] }; if (Session["log_staff"] != null) { inventor.log_staff = Session["log_staff"].ToString(); } inventor.visible = xvisible; c_inv = null; c_inv = inventor; lt_xinv.Add(c_inv); } } c_pri.countryID = select_country_pri.SelectedValue; c_pri.app_no = txt_application_no_pri.Text; c_pri.xdate = txt_date_pri.Text; if (Session["log_staff"] != null) { c_pri.log_staff = Session["log_staff"].ToString(); } c_pri.xvisible = xvisible; lt_xpri.Add(c_pri); if (((((lt_mix.Count == 0) && (lt_repx.Count == 0)) && ((lt_appx.Count == 0) && (lt_invx.Count == 0))) && (lt_assinfox.Count == 0)) && (lt_xprix.Count == 0)) { pt_succ = t.addNewPatent(lt_xapp, lt_xpri, lt_xinv, c_ptinfo, c_assinfo, c_rep); } else { if (lt_repx.Count == 0) { rep_updateID = t.addRepresentative(c_rep); } else { rep_updateID = t.updateRepresentative(c_rep); } if (lt_assinfox.Count == 0) { if (((((c_assinfo.assignee_name != null) && (c_assinfo.assignee_name != "")) && ((c_assinfo.date_of_assignment != null) && (c_assinfo.date_of_assignment != ""))) && (c_assinfo.ID != null)) && (c_assinfo.ID != "")) { assinfo_updateID = t.addAssignment_info(c_assinfo); } } else if (((c_assinfo.ID != null)) && (c_assinfo.ID != "")) { assinfo_updateID = t.updateAssignment_info(c_assinfo); } if (lt_xprix.Count == 0) { // pri_updateID = t.addPriority_info(c_pri); } else { foreach (GridViewRow row in Gridview1.Rows) { String box = ((TextBox)row.FindControl("txt_name_pri")).Text; String box2 = ((TextBox)row.FindControl("txt_pri_date")).Text; String box3 = ((TextBox)row.FindControl("vid")).Text; String box4 = ((DropDownList)row.FindControl("select_inv_nationality2")).SelectedValue; var dd = ""; c_pri.app_no = box; c_pri.countryID = box4; c_pri.xdate = box2; c_pri.xID = box3; if (box3 != "") { pri_updateID = t.updatePriority_info(c_pri); } // TextBox box = ((TextBox)row.FindControl("txt_name_pri"); } for (num = 0; num < lt_pri.Count; num++) { // pri_updateID = t.updatePriority_info(c_pri); } } if (lt_xapp.Count == 0) { foreach (pt.Applicant applicant2 in lt_xapp) { if ((applicant2.xname != null) && (applicant2.xname != "")) { app_updateID = t.addApplicant(applicant2); } } } else { t.deleteApplicant(lt_pwx[0].ID); foreach (pt.Applicant applicant2 in lt_xapp) { if ((applicant2.xname != null) && (applicant2.xname != "")) { app_updateID = t.addApplicant(applicant2); } } } if (lt_xinv.Count == 0) { foreach (pt.Inventor inventor2 in lt_xinv) { if ((inventor2.xname != null) && (inventor2.xname != "")) { inv_updateID = t.addInventor(inventor2); } else { t.deleteInventor(inventor2.log_staff); } } } else { t.deleteInventor(lt_pwx[0].ID); foreach (pt.Inventor inventor2 in lt_xinv) { if ((inventor2.xname != null) && (inventor2.xname != "")) { inv_updateID = t.addInventor(inventor2); } else { t.deleteInventor(inventor2.log_staff); } } } if (lt_mix.Count == 0) { mix_updateID = t.addPt(c_ptinfo); t.updatePtReg(mix_updateID, c_ptinfo.xtype); Session["mix_updateID"] = c_ptinfo.xID; if (Convert.ToInt32(mix_updateID) > 0) { Response.Redirect("./edit_form_docs.aspx"); } } else { mix_updateID = t.updatePtInfo(c_ptinfo); // t.updatePtReg(c_ptinfo.xID, c_ptinfo.xtype); Session["mix_updateID"] = c_ptinfo.xID; if (Convert.ToInt32(mix_updateID) > 0) { Response.Redirect("./edit_form_docs.aspx"); } } t.activity_log(admin, "Edit Application", "Update", lt_pwx[0].ID, lt_pwx[0].data_status, oldproduct_title, txt_title_of_invention.Text, oldname, lt_app[0]["txt_name_app"], "", ""); } }