Example #1
0
        protected void SaveAll_Click(object sender, EventArgs e)
        {
            string[]           tx = null;
            TransactionOptions transactionOptions = new TransactionOptions
            {
                IsolationLevel = IsolationLevel.ReadCommitted,
                Timeout        = new TimeSpan(0, 15, 0)
            };
            TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, transactionOptions);

            try
            {
                if (Session["c_pwall"] != null)
                {
                    c_pwall = (tm.Stage)Session["c_pwall"];
                }
                if (Session["c_app"] != null)
                {
                    c_app = (tm.Applicant)Session["c_app"];
                }
                if (Session["c_app_addy"] != null)
                {
                    c_app_addy = (tm.Address)Session["c_app_addy"];
                }
                if (Session["c_rep_addy"] != null)
                {
                    c_rep_addy = (tm.Address)Session["c_rep_addy"];
                }
                if (Session["c_mark"] != null)
                {
                    c_mark = (tm.MarkInfo)Session["c_mark"];
                }
                if (Session["c_aos"] != null)
                {
                    c_aos = (tm.AddressService)Session["c_aos"];
                }
                if (Session["c_rep"] != null)
                {
                    c_rep = (tm.Representative)Session["c_rep"];
                }
                tx = c_pwall.validationID.Trim().Split('-');
                if (tx.Length == 3)
                {
                    hwalletID = tx[2];
                }
                else
                {
                    hwalletID = "0";
                }
                c_pwall.rtm = txt_rtm.Text;
                if (txt_new_date.Text != "")
                {
                    c_pwall.reg_date = txt_new_date.Text;
                }
                oldname     = c_app.xname;
                c_app.xname = xname.Text;

                c_app.nationality = nationality.Text;
                if (txt_new_date.Text != "")
                {
                    c_app.reg_date = txt_new_date.Text;
                }
                c_app_addy.countryID  = residence.Text;
                c_app_addy.stateID    = xselectState.Text;
                c_app_addy.street     = xaddress.Text;
                c_app_addy.telephone1 = xtelephone.Text;
                c_app_addy.email1     = xemail.Text;
                if (txt_new_date.Text != "")
                {
                    c_app_addy.reg_date = txt_new_date.Text;
                }

                c_mark.tm_typeID          = tmType.SelectedValue;
                c_mark.logo_descriptionID = logo_description.SelectedValue;
                oldproduct_title          = c_mark.product_title;
                c_mark.product_title      = title_of_product.Text;
                oldclass                = c_mark.nice_class;
                c_mark.nice_class       = national_class.SelectedValue;
                c_mark.nice_class_desc  = nice_class_desc.Text;
                c_mark.national_classID = national_class.SelectedValue;
                c_mark.disclaimer       = txt_discalimer.Text;
                c_mark.reg_number       = TextBox1.Text;
                if (txt_new_date.Text != "")
                {
                    c_mark.reg_date = txt_new_date.Text;
                }

                c_aos.countryID  = "160";
                c_aos.stateID    = aos_xselectState.Text;
                c_aos.city       = "";
                c_aos.street     = aos_xaddress.Text;
                c_aos.telephone1 = aos_xtelephone.Text;
                c_aos.email1     = aos_xemail.Text;
                if (txt_new_date.Text != "")
                {
                    c_aos.reg_date = txt_new_date.Text;
                }

                c_rep.agent_code  = xcode.Text;
                c_rep.xname       = rep_xname.Text;
                c_rep.nationality = rep_nationality.SelectedValue;
                c_rep.log_staff   = "0";
                if (txt_new_date.Text != "")
                {
                    c_rep.reg_date = txt_new_date.Text;
                }

                c_rep_addy.countryID  = rep_residence.SelectedValue;
                c_rep_addy.stateID    = xselectRepState.SelectedValue;
                c_rep_addy.city       = "";
                c_rep_addy.street     = rep_address.Text;
                c_rep_addy.telephone1 = rep_xtelephone.Text;
                c_rep_addy.email1     = rep_xemail.Text;
                if (txt_new_date.Text != "")
                {
                    c_rep_addy.reg_date = txt_new_date.Text;
                }


                if (Session["hwalletID"] != null)
                {
                    hwalletID = Session["hwalletID"].ToString();
                }

                Boolean vfile = false;

                if (logo_description.SelectedItem.Value != "2")
                {
                    vfile = true;
                }
                else
                {
                    vfile = false;
                }
                succ = t.editTrademarkTx(c_app, c_mark, c_aos, c_rep, c_app_addy, c_rep_addy, c_pwall, sl_docz, logo_pic, auth_doc, sup_doc1, sup_doc2, Server.MapPath("~/"), vfile);
                if (Convert.ToInt32(succ) > 0)
                {
                    //ws_payx.payx ws_p = new ws_payx.payx();
                    //status = ws_p.UpdateHwallet(hwalletID, "Used", reg_date, title_of_product.Text);
                    //if (status >= 0)
                    //{
                    scope.Complete(); scope.Dispose();
                    //}
                    //else
                    //{
                    //    scope.Dispose();
                    //    succ_msg = "Record Not Edited Successfully! Please try again";
                    //    showsearch = 0;
                    //}
                }
                else
                {
                    scope.Dispose();
                    succ_msg   = "Record Not Edited Successfully! Please try again";
                    showsearch = 0;
                }

                this.adminID = this.Session["pwalletID"].ToString();

                t.activity_log(this.adminID, "Edit Application", "Update", c_app.log_staff, c_pwall.data_status, title_of_product.Text, oldproduct_title, oldname, xname.Text, oldclass, national_class.SelectedValue);
                /////
            }
            catch (Exception exception)
            {
                exception.ToString(); scope.Dispose();
                succ_msg   = "Record Not Edited Successfully! Please try again";
                showsearch = 0;
            }
            finally
            {
                if (scope != null)
                {
                    scope.Dispose();
                }
            }
            succ_msg   = "Record Edited Successfully!!!"; txt_search.Text = "";
            showsearch = 0;
        }