예제 #1
0
        protected void SaveAll_Click(object sender, EventArgs e)
        {
            if (this.Session["lt_app"] != null)
            {
                lt_app.Clear(); lt_app = (List <tm.Applicant>) this.Session["lt_app"];
            }
            if (this.Session["lt_mi"] != null)
            {
                lt_mi.Clear(); lt_mi = (List <tm.MarkInfo>) this.Session["lt_mi"];
            }
            if (this.Session["lt_aos"] != null)
            {
                lt_aos.Clear(); lt_aos = (List <tm.AddressService>) this.Session["lt_aos"];
            }
            if (this.Session["lt_rep"] != null)
            {
                lt_rep.Clear(); lt_rep = (List <tm.Representative>) this.Session["lt_rep"];
            }
            if (this.Session["lt_appaddy"] != null)
            {
                lt_appaddy.Clear(); lt_appaddy = (List <tm.Address>) this.Session["lt_appaddy"];
            }
            if (this.Session["lt_repaddy"] != null)
            {
                lt_repaddy.Clear(); lt_repaddy = (List <tm.Address>) this.Session["lt_repaddy"];
            }

            this.SaveAll.Visible       = false;
            this.c_app.xname           = this.xname.Text;
            this.c_app.nationality     = this.nationality.Text;
            this.c_app.log_staff       = Session["pwalletID"].ToString();
            this.c_app.reg_date        = reg_date;
            this.c_app.visible         = visible;
            this.c_app_addy.countryID  = this.residence.Text;
            this.c_app_addy.stateID    = this.xselectState.Text;
            this.c_app_addy.city       = "";
            this.c_app_addy.street     = this.xaddress.Text;
            this.c_app_addy.telephone1 = this.xtelephone.Text;
            this.c_app_addy.email1     = this.xemail.Text;
            this.c_app_addy.log_staff  = Session["pwalletID"].ToString();
            this.c_app_addy.reg_date   = reg_date;
            this.c_app_addy.visible    = visible;

            this.c_mark.tm_typeID          = this.tmType.SelectedValue;
            this.c_mark.logo_descriptionID = this.logo_description.SelectedValue;
            this.c_mark.product_title      = this.title_of_product.Text;
            this.c_mark.nice_class         = this.national_class.SelectedValue;
            this.c_mark.nice_class_desc    = this.nice_class_desc.Text;
            this.c_mark.national_classID   = this.national_class.SelectedValue;
            this.c_mark.disclaimer         = this.txt_discalimer.Text;
            this.c_mark.log_staff          = Session["pwalletID"].ToString();
            this.c_mark.reg_date           = reg_date;
            this.c_mark.xvisible           = visible;

            this.c_aos.stateID         = this.aos_xselectState.Text;
            this.c_aos.city            = "";
            this.c_aos.street          = this.aos_xaddress.Text;
            this.c_aos.telephone1      = this.aos_xtelephone.Text;
            this.c_aos.email1          = this.aos_xemail.Text;
            this.c_aos.log_staff       = Session["pwalletID"].ToString();
            this.c_aos.reg_date        = reg_date;
            this.c_aos.visible         = visible;
            this.c_rep.agent_code      = this.xaid.Value;
            this.c_rep.xname           = this.rep_xname.Text;
            this.c_rep.nationality     = this.rep_nationality.SelectedValue;
            this.c_rep.log_staff       = Session["pwalletID"].ToString();
            this.c_rep.reg_date        = reg_date;
            this.c_rep.visible         = visible;
            this.c_rep_addy.countryID  = this.rep_residence.SelectedValue;
            this.c_rep_addy.stateID    = this.xselectRepState.SelectedValue;
            this.c_rep_addy.city       = "";
            this.c_rep_addy.street     = this.rep_address.Text;
            this.c_rep_addy.telephone1 = this.rep_xtelephone.Text;
            this.c_rep_addy.email1     = this.rep_xemail.Text;
            this.c_rep_addy.reg_date   = reg_date;
            this.c_rep_addy.log_staff  = Session["pwalletID"].ToString();
            this.c_rep_addy.visible    = visible;

            Session["c_app"] = c_app; Session["c_mark"] = c_mark; Session["c_aos"] = c_aos;
            Session["c_rep"] = c_rep; Session["c_app_addy"] = c_app_addy; Session["c_rep_addy"] = c_rep_addy;

            this.pwalletID = this.xpwalletID.Value;
            if (Session["lt_aosID"] != null)
            {
                c_aos.ID = Session["lt_aosID"].ToString();
            }
            if (Session["lt_miID"] != null)
            {
                c_mark.xID = Session["lt_miID"].ToString();
            }
            if (Session["lt_appID"] != null)
            {
                c_app.ID = Session["lt_appID"].ToString();
            }
            if (Session["lt_repID"] != null)
            {
                c_rep.ID = Session["lt_repID"].ToString();
            }
            if (Session["lt_appaddyID"] != null)
            {
                c_app_addy.ID = Session["lt_appaddyID"].ToString();
            }
            if (Session["lt_repaddyID"] != null)
            {
                c_rep_addy.ID = Session["lt_repaddyID"].ToString();
            }

            if ((lt_app.Count == 0) && (lt_aos.Count == 0) && (lt_rep.Count == 0) && (lt_mi.Count == 0) && (lt_appaddy.Count == 0) && (lt_repaddy.Count == 0))
            {
                this.xmarkID.Value = this.t.addTrademark(this.c_app, this.c_mark, this.c_aos, this.c_rep, this.c_app_addy, this.c_rep_addy, this.log_staffID);

                if (this.xmarkID.Value != "0")
                {
                    this.show_image_section = "1";
                    Session["mi_updateID"]  = this.xmarkID.Value;
                    Response.Redirect("./trademark_refill_docs.aspx");
                }
            }
            else
            {
                if (lt_appaddy.Count == 0)
                {
                    this.appaddy_updateID = Convert.ToInt32(t.addAddress(c_app_addy, adminID));
                }
                else
                {
                    if (Session["ltappaddy_regdate"] != null)
                    {
                        c_app_addy.reg_date = this.Session["ltappaddy_regdate"].ToString();
                    }
                    this.appaddy_updateID = t.UpdateAddress(c_app_addy);
                }

                if (lt_app.Count == 0)
                {
                    if (lt_appaddy.Count == 0)
                    {
                        c_app.addressID = appaddy_updateID.ToString();
                    }
                    else
                    {
                        c_app.addressID = lt_appaddy[0].ID;
                    }

                    this.app_updateID = Convert.ToInt32(t.addSoloApplicant(c_app));
                }
                else
                {
                    if (Session["ltapp_regdate"] != null)
                    {
                        c_app.reg_date = this.Session["ltapp_regdate"].ToString();
                    }
                    this.app_updateID = t.UpdateApplicant(c_app);
                }

                if (lt_repaddy.Count == 0)
                {
                    this.repaddy_updateID = Convert.ToInt32(t.addAddress(c_rep_addy, adminID));
                }
                else
                {
                    if (Session["ltrepaddy_regdate"] != null)
                    {
                        c_rep_addy.reg_date = this.Session["ltrepaddy_regdate"].ToString();
                    }
                    this.repaddy_updateID = t.UpdateAddress(c_rep_addy);
                }

                if (lt_rep.Count == 0)
                {
                    if (lt_repaddy.Count == 0)
                    {
                        c_rep.addressID = repaddy_updateID.ToString();
                    }
                    else
                    {
                        c_rep.addressID = lt_repaddy[0].ID;
                    }

                    this.rep_updateID = Convert.ToInt32(t.addSoloRepresentative(c_rep));
                }
                else
                {
                    if (Session["ltrep_regdate"] != null)
                    {
                        c_rep.reg_date = this.Session["ltrep_regdate"].ToString();
                    }
                    this.rep_updateID = t.UpdateRep(c_rep);
                }

                if (lt_aos.Count == 0)
                {
                    this.aos_updateID = Convert.ToInt32(t.addAos(c_aos, adminID));
                }
                else
                {
                    if (Session["ltaos_regdate"] != null)
                    {
                        c_aos.reg_date = this.Session["ltaos_regdate"].ToString();
                    }
                    this.aos_updateID = t.UpdateAos(c_aos);
                }

                if (lt_mi.Count == 0)
                {
                    this.mi_updateID = Convert.ToInt32(t.addMark(c_mark, adminID));
                    t.updateMarkReg(mi_updateID.ToString(), c_mark.tm_typeID);
                    Session["mi_updateID"] = c_mark.xID;
                    if (mi_updateID > 0)
                    {
                        Response.Redirect("./trademark_refill_docs.aspx");
                    }
                }
                else
                {
                    if (Session["ltmi_regdate"] != null)
                    {
                        c_mark.reg_date = this.Session["ltmi_regdate"].ToString();
                    }
                    this.mi_updateID = t.UpdateMark(c_mark);
                    t.updateMarkReg(c_mark.xID, c_mark.tm_typeID);
                    Session["mi_updateID"] = c_mark.xID;
                    if (mi_updateID > 0)
                    {
                        Response.Redirect("./trademark_refill_docs.aspx");
                    }
                }
            }
        }