Esempio n. 1
0
 private void upload_Clicked(object sender, EventArgs e)
 {
     try
     {
         if (Session["new_ptID"] != null)
         {
             string str;
             string str2;
             doc_path = Server.MapPath("~/") + "admin/pt/docz/" + Session["new_ptID"].ToString() + "/";
             if (!Directory.Exists(doc_path))
             {
                 Directory.CreateDirectory(doc_path);
             }
             if (IsValid && fu_loa_doc.HasFile)
             {
                 loa_newfilename = Path.Combine(doc_path, fu_loa_doc.FileName.Replace(" ", "_"));
                 fu_loa_doc.MoveTo(Path.Combine(doc_path, fu_loa_doc.FileName.Replace(" ", "_")), MoveToOptions.Overwrite);
                 Session["txt_loa_no"] = txt_loa_no.Text;
             }
             if (IsValid && fu_claim_doc.HasFile)
             {
                 claim_newfilename = Path.Combine(doc_path, fu_claim_doc.FileName.Replace(" ", "_"));
                 fu_claim_doc.MoveTo(claim_newfilename, MoveToOptions.Overwrite);
                 Session["txt_claim_no"] = txt_claim_no.Text;
             }
             if (IsValid && fu_pct_doc.HasFile)
             {
                 pct_newfilename = Path.Combine(doc_path, fu_pct_doc.FileName.Replace(" ", "_"));
                 fu_pct_doc.MoveTo(pct_newfilename, MoveToOptions.Overwrite);
                 Session["txt_pct_no"] = txt_pct_no.Text;
             }
             if (IsValid && fu_doa_doc.HasFile)
             {
                 doa_newfilename = Path.Combine(doc_path, fu_doa_doc.FileName.Replace(" ", "_"));
                 fu_doa_doc.MoveTo(doa_newfilename, MoveToOptions.Overwrite);
                 Session["txt_doa_no"] = txt_doa_no.Text;
             }
             if (IsValid && fu_spec_doc.HasFile)
             {
                 spec_newfilename = Path.Combine(doc_path, fu_spec_doc.FileName.Replace(" ", "_"));
                 fu_spec_doc.MoveTo(spec_newfilename, MoveToOptions.Overwrite);
             }
             loa_newfilename              = loa_newfilename.Replace(Server.MapPath("~/") + "admin/pt/", "");
             claim_newfilename            = claim_newfilename.Replace(Server.MapPath("~/") + "admin/pt/", "");
             pct_newfilename              = pct_newfilename.Replace(Server.MapPath("~/") + "admin/pt/", "");
             doa_newfilename              = doa_newfilename.Replace(Server.MapPath("~/") + "admin/pt/", "");
             spec_newfilename             = spec_newfilename.Replace(Server.MapPath("~/") + "admin/pt/", "");
             Session["loa_newfilename"]   = loa_newfilename;
             Session["claim_newfilename"] = claim_newfilename;
             Session["pct_newfilename"]   = pct_newfilename;
             Session["doa_newfilename"]   = doa_newfilename;
             Session["spec_newfilename"]  = spec_newfilename;
             if (pc == "P001")
             {
                 if ((((loa_newfilename != "0") && (claim_newfilename != "0")) && ((pct_newfilename != "0") && (doa_newfilename != "0"))) && (spec_newfilename != "0"))
                 {
                     if (Session["txt_loa_no"] != null)
                     {
                         txt_loa_no.Text = Session["txt_loa_no"].ToString();
                     }
                     if (Session["txt_claim_no"] != null)
                     {
                         txt_claim_no.Text = Session["txt_claim_no"].ToString();
                     }
                     if (Session["txt_pct_no"] != null)
                     {
                         txt_pct_no.Text = Session["txt_pct_no"].ToString();
                     }
                     if (Session["txt_doa_no"] != null)
                     {
                         txt_doa_no.Text = Session["txt_doa_no"].ToString();
                     }
                     if (t.updatePtDocz(spec_newfilename, loa_newfilename, txt_loa_no.Text, claim_newfilename, txt_claim_no.Text, pct_newfilename, txt_pct_no.Text, doa_newfilename, txt_doa_no.Text, Session["new_ptID"].ToString()) != "0")
                     {
                         str  = "";
                         str2 = "";
                         if (Session["vid"] != null)
                         {
                             str = Session["vid"].ToString();
                         }
                         if (Session["gt"] != null)
                         {
                             str2 = Session["gt"].ToString();
                         }
                         status = ipo_gateway.UpdateTransaction(str, str2, "1");
                         if (status == "1")
                         {
                             ack_status = "1";
                         }
                     }
                 }
             }
             else if (((loa_newfilename != "0") && (claim_newfilename != "0")) && (spec_newfilename != "0"))
             {
                 if (Session["txt_loa_no"] != null)
                 {
                     txt_loa_no.Text = Session["txt_loa_no"].ToString();
                 }
                 if (Session["txt_claim_no"] != null)
                 {
                     txt_claim_no.Text = Session["txt_claim_no"].ToString();
                 }
                 if (Session["txt_pct_no"] != null)
                 {
                     txt_pct_no.Text = Session["txt_pct_no"].ToString();
                 }
                 if (Session["txt_doa_no"] != null)
                 {
                     txt_doa_no.Text = Session["txt_doa_no"].ToString();
                 }
                 if (t.updatePtDocz(spec_newfilename, loa_newfilename, txt_loa_no.Text, claim_newfilename, txt_claim_no.Text, pct_newfilename, txt_pct_no.Text, doa_newfilename, txt_doa_no.Text, Session["new_ptID"].ToString()) != "0")
                 {
                     str  = "";
                     str2 = "";
                     if (Session["vid"] != null)
                     {
                         str = Session["vid"].ToString();
                     }
                     if (Session["gt"] != null)
                     {
                         str2 = Session["gt"].ToString();
                     }
                     status = ipo_gateway.UpdateTransaction(str, str2, "1");
                     status = "1";
                     if (status == "1")
                     {
                         ack_status = "1";
                     }
                 }
             }
         }
     }
     catch (Exception exception)
     {
     }
 }
Esempio n. 2
0
    protected void SaveAll_Click(object sender, EventArgs e)
    {
        TransactionOptions transactionOptions = new TransactionOptions {
            IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted,
            Timeout        = TimeSpan.FromMinutes(10.0)
        };
        TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, transactionOptions);

        try
        {
            int num;
            SetLatestRowsFromGrid_App_gv();
            SetLatestRowsFromGrid_Inv_gv();
            SetLatestRowsFromGrid_Pri_gv();
            pt.PtInfo               info           = new pt.PtInfo();
            pt.Assignment_info      _info          = new pt.Assignment_info();
            pt.Representative       representative = new pt.Representative();
            List <pt.Applicant>     list           = new List <pt.Applicant>();
            List <pt.Inventor>      list2          = new List <pt.Inventor>();
            List <pt.Priority_info> list3          = new List <pt.Priority_info>();
            info.reg_number         = "";
            info.xtype              = lbl_type.Text;
            info.title_of_invention = txt_title_of_invention.Text;
            info.pt_desc            = txt_pt_desc.Text;
            if (Session["pwalletID"] != null)
            {
                info.log_staff = Session["pwalletID"].ToString();
            }
            info.reg_date              = xreg_date;
            info.xvisible              = xvisible;
            info.claim_no              = "0";
            info.loa_no                = "0";
            info.pct_no                = "0";
            info.doa_no                = "0";
            _info.date_of_assignment   = txt_assignment_date.Text;
            _info.assignee_name        = txt_assignee_name.Text;
            _info.assignee_address     = txt_assignee_address.Text;
            _info.assignee_nationality = select_assignee_nationality.SelectedValue;
            _info.assignor_name        = txt_assignor_name.Text;
            _info.assignor_address     = txt_assignor_address.Text;
            _info.assignor_nationality = select_assignor_nationality.SelectedValue;
            if (Session["pwalletID"] != null)
            {
                _info.log_staff = Session["pwalletID"].ToString();
            }
            _info.visible              = xvisible;
            representative.agent_code  = rep_code.Text;
            representative.xname       = rep_xname.Text;
            representative.nationality = "160";
            representative.country     = "160";
            representative.state       = select_rep_state.SelectedValue;
            representative.address     = txt_rep_address.Text;
            representative.xmobile     = txt_rep_telephone.Text;
            representative.xemail      = txt_rep_email.Text;
            representative.reg_date    = xreg_date;
            representative.visible     = xvisible;
            if (Session["pwalletID"] != null)
            {
                representative.log_staff = Session["pwalletID"].ToString();
            }
            lt_app = (List <SortedList <string, string> >)Session["lt_app"];
            lt_inv = (List <SortedList <string, string> >)Session["lt_inv"];
            lt_pri = (List <SortedList <string, string> >)Session["lt_pri"];
            if (lt_app.Count > 0)
            {
                for (num = 0; num < lt_app.Count; num++)
                {
                    pt.Applicant item = 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["pwalletID"] != null)
                    {
                        item.log_staff = Session["pwalletID"].ToString();
                    }
                    item.visible = xvisible;
                    list.Add(item);
                }
            }
            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["pwalletID"] != null)
                    {
                        inventor.log_staff = Session["pwalletID"].ToString();
                    }
                    inventor.visible = xvisible;
                    list2.Add(inventor);
                }
            }
            if (lt_pri.Count > 0)
            {
                for (num = 0; num < lt_pri.Count; num++)
                {
                    pt.Priority_info _info2 = new pt.Priority_info {
                        countryID = lt_pri[num]["select_country_pri"],
                        app_no    = lt_pri[num]["txt_application_no_pri"],
                        xdate     = lt_pri[num]["txt_date_pri"]
                    };
                    if (Session["pwalletID"] != null)
                    {
                        _info2.log_staff = Session["pwalletID"].ToString();
                    }
                    _info2.xvisible = xvisible;
                    list3.Add(_info2);
                }
            }
            if (Session["hwalletID"] != null)
            {
                hwalletID = Session["hwalletID"].ToString();
                status    = t.updateHwallet(hwalletID, "Used", xreg_date, txt_title_of_invention.Text).ToString();
            }
            int num3 = t.addNewPatentX(list, list3, list2, info, _info, representative, transID, aid, amt, hwalletID);
            if (num3 > 0)
            {
                Session["new_ptID"] = null;
                Session["new_ptID"] = num3;
            }
            if (Session["new_ptID"] != null)
            {
                string str;
                string str2;
                doc_path = Server.MapPath("~/") + "admin/pt/docz/" + Session["new_ptID"].ToString() + "/";
                if (!Directory.Exists(doc_path))
                {
                    Directory.CreateDirectory(doc_path);
                }
                if (IsValid && fu_loa_doc.HasFile)
                {
                    loa_newfilename = Path.Combine(doc_path, fu_loa_doc.FileName.Replace(" ", "_"));
                    fu_loa_doc.MoveTo(Path.Combine(doc_path, fu_loa_doc.FileName.Replace(" ", "_")), MoveToOptions.Overwrite);
                    Session["txt_loa_no"] = txt_loa_no.Text;
                }
                if (IsValid && fu_claim_doc.HasFile)
                {
                    claim_newfilename = Path.Combine(doc_path, fu_claim_doc.FileName.Replace(" ", "_"));
                    fu_claim_doc.MoveTo(claim_newfilename, MoveToOptions.Overwrite);
                    Session["txt_claim_no"] = txt_claim_no.Text;
                }
                if (IsValid && fu_pct_doc.HasFile)
                {
                    pct_newfilename = Path.Combine(doc_path, fu_pct_doc.FileName.Replace(" ", "_"));
                    fu_pct_doc.MoveTo(pct_newfilename, MoveToOptions.Overwrite);
                    Session["txt_pct_no"] = txt_pct_no.Text;
                }
                if (IsValid && fu_doa_doc.HasFile)
                {
                    doa_newfilename = Path.Combine(doc_path, fu_doa_doc.FileName.Replace(" ", "_"));
                    fu_doa_doc.MoveTo(doa_newfilename, MoveToOptions.Overwrite);
                    Session["txt_doa_no"] = txt_doa_no.Text;
                }
                if (IsValid && fu_spec_doc.HasFile)
                {
                    spec_newfilename = Path.Combine(doc_path, fu_spec_doc.FileName.Replace(" ", "_"));
                    fu_spec_doc.MoveTo(spec_newfilename, MoveToOptions.Overwrite);
                }
                loa_newfilename              = loa_newfilename.Replace(Server.MapPath("~/") + "admin/pt/", "");
                claim_newfilename            = claim_newfilename.Replace(Server.MapPath("~/") + "admin/pt/", "");
                pct_newfilename              = pct_newfilename.Replace(Server.MapPath("~/") + "admin/pt/", "");
                doa_newfilename              = doa_newfilename.Replace(Server.MapPath("~/") + "admin/pt/", "");
                spec_newfilename             = spec_newfilename.Replace(Server.MapPath("~/") + "admin/pt/", "");
                Session["loa_newfilename"]   = loa_newfilename;
                Session["claim_newfilename"] = claim_newfilename;
                Session["pct_newfilename"]   = pct_newfilename;
                Session["doa_newfilename"]   = doa_newfilename;
                Session["spec_newfilename"]  = spec_newfilename;
                if (pc == "P001")
                {
                    if ((((loa_newfilename != "0") && (claim_newfilename != "0")) && ((pct_newfilename != "0") && (doa_newfilename != "0"))) && (spec_newfilename != "0"))
                    {
                        if (Session["txt_loa_no"] != null)
                        {
                            txt_loa_no.Text = Session["txt_loa_no"].ToString();
                        }
                        if (Session["txt_claim_no"] != null)
                        {
                            txt_claim_no.Text = Session["txt_claim_no"].ToString();
                        }
                        if (Session["txt_pct_no"] != null)
                        {
                            txt_pct_no.Text = Session["txt_pct_no"].ToString();
                        }
                        if (Session["txt_doa_no"] != null)
                        {
                            txt_doa_no.Text = Session["txt_doa_no"].ToString();
                        }
                        if (t.updatePtDocz(spec_newfilename, loa_newfilename, txt_loa_no.Text, claim_newfilename, txt_claim_no.Text, pct_newfilename, txt_pct_no.Text, doa_newfilename, txt_doa_no.Text, Session["new_ptID"].ToString()) != "0")
                        {
                            str  = "";
                            str2 = "";
                            if (Session["vid"] != null)
                            {
                                str = Session["vid"].ToString();
                            }
                            if (Session["gt"] != null)
                            {
                                str2 = Session["gt"].ToString();
                            }
                            status = ipo_gateway.UpdateTransaction(str, str2, "1");
                            scope.Complete();
                            status = "1";
                            if (status == "1")
                            {
                                ack_status = "1";
                                if (Session["vid"] != null)
                                {
                                    Response.Redirect("./tm_acknowledgement.aspx?0001234445XXX43943OPFDSMZXUHSJFDSKFGKSDKGFSDKFSKFDKFD=" + Session["vid"].ToString(), false);
                                }
                                else
                                {
                                    Response.Redirect("./appstatus.aspx", false);
                                }
                            }
                            else
                            {
                                Response.Redirect("./appstatus.aspx", false);
                            }
                        }
                        else
                        {
                            scope.Dispose();
                        }
                    }
                }
                else if (((loa_newfilename != "0") && (claim_newfilename != "0")) && (spec_newfilename != "0"))
                {
                    if (Session["txt_loa_no"] != null)
                    {
                        txt_loa_no.Text = Session["txt_loa_no"].ToString();
                    }
                    if (Session["txt_claim_no"] != null)
                    {
                        txt_claim_no.Text = Session["txt_claim_no"].ToString();
                    }
                    if (Session["txt_pct_no"] != null)
                    {
                        txt_pct_no.Text = Session["txt_pct_no"].ToString();
                    }
                    if (Session["txt_doa_no"] != null)
                    {
                        txt_doa_no.Text = Session["txt_doa_no"].ToString();
                    }
                    if (t.updatePtDocz(spec_newfilename, loa_newfilename, txt_loa_no.Text, claim_newfilename, txt_claim_no.Text, pct_newfilename, txt_pct_no.Text, doa_newfilename, txt_doa_no.Text, Session["new_ptID"].ToString()) != "0")
                    {
                        str  = "";
                        str2 = "";
                        if (Session["vid"] != null)
                        {
                            str = Session["vid"].ToString();
                        }
                        if (Session["gt"] != null)
                        {
                            str2 = Session["gt"].ToString();
                        }
                        status = ipo_gateway.UpdateTransaction(str, str2, "1");
                        scope.Complete();
                        status = "1";
                        if (status == "1")
                        {
                            ack_status = "1";
                            if (Session["vid"] != null)
                            {
                                Response.Redirect("./tm_acknowledgement.aspx?0001234445XXX43943OPFDSMZXUHSJFDSKFGKSDKGFSDKFSKFDKFD=" + Session["vid"].ToString(), false);
                            }
                            else
                            {
                                Response.Redirect("./appstatus.aspx", false);
                            }
                        }
                        else
                        {
                            Response.Redirect("./appstatus.aspx", false);
                        }
                    }
                    else
                    {
                        scope.Dispose();
                    }
                }
            }
            else
            {
                scope.Dispose();
            }
        }
        catch (Exception exception)
        {
            string str3 = exception.ToString();
            scope.Dispose();
        }
        finally
        {
            if (scope != null)
            {
                scope.Dispose();
            }
        }
    }