Exemplo n.º 1
0
    public string GetCompanyName(int CodePeigiri)
    {
        string msg = "0";
        if (new MainDataModuleTableAdapters.tbl_ones_haghighiTableAdapter().GetDataBy4(CodePeigiri).Rows.Count != 0)
        {
            DataRow dr = new MainDataModuleTableAdapters.tbl_ones_haghighiTableAdapter().GetDataBy4(CodePeigiri)[0];
            XmlDocument doc_address = new XmlDocument();
            doc_address.InnerXml = dr["oh_personal_inf"].ToString();
            XmlNode xnl = doc_address.ChildNodes[0];
            XmlNode xms = xnl.ChildNodes[2];
            msg = xms.InnerText;

        }
        else
        {
            if (new MainDataModuleTableAdapters.tbl_ones_hoghoghiTableAdapter().GetDataBy3(CodePeigiri).Rows.Count != 0)
            {
                DataRow dr = new MainDataModuleTableAdapters.tbl_ones_hoghoghiTableAdapter().GetDataBy3(CodePeigiri)[0];
                msg = dr["oho_name"].ToString();

            }
        }

        return msg;
    }
Exemplo n.º 2
0
    protected void btn_add_new_person_Click(object sender, EventArgs e)
    {
        try
        {
            string idcode = "";
            XmlDocument doc_address = new XmlDocument();
            doc_address.InnerXml = pnl_address_information_form1.get_frm_xml_with_value();
            if (Session["IsInEditingMode"] == null)
            {
                new MainDataModuleTableAdapters.tbl_ones_hoghoghiTableAdapter().Insert(
                    Convert.ToInt32(oho_link_to_type_of_hoghoghi_personality.SelectedValue.ToString()),
                    Convert.ToInt32(drp_oho_type_of_owner.SelectedValue.ToString()),
                    oho_unique_id.Text,
                    oho_name.Text,
                    oho_no_of_registration.Text,
                    oho_date_og_registration.Text,
                    oho_place_of_registration.Text,
                    oho_tax.Text,
                    oho_insurace.Text,
                    oho_mngr_family.Text,
                    oho_mngr_name.Text,
                    oho_mngr_international_code.Text,
                    Convert.ToInt32(oho_mngr_sex.SelectedValue.ToString()),
                    Convert.ToInt32(oho_mngr_link_to_eduction.SelectedValue.ToString()),
                    oho_mngr_branch.Text,
                    oho_mngr_date_of_birth.Text,
                    oho_mngr_mobile.Text,
                    0, 0, 0, Convert.ToInt32(DropDownList1.SelectedValue.ToString()), doc_address.InnerXml);

                idcode = new MainDataModuleTableAdapters.tbl_ones_hoghoghiTableAdapter().Get_iD_from_international_code(oho_unique_id.Text).Value.ToString();

                frm_one_managers1.insert(idcode);
                frm_one_observers1.insert(idcode);
                frm_one_add_utilities1.insert(idcode);
                frm_one_employers1.insert(idcode);
                frm_one_equipments_in_hand1.insert(idcode);

            }
            else
            {
                string cdpeig = Session["IsInEditingMode"].ToString();
                new MainDataModuleTableAdapters.tbl_ones_hoghoghiTableAdapter().Update(
                    Convert.ToInt32(oho_link_to_type_of_hoghoghi_personality.SelectedValue.ToString()),
                    Convert.ToInt32(drp_oho_type_of_owner.SelectedValue.ToString()),
                    oho_unique_id.Text,
                    oho_name.Text,
                    oho_no_of_registration.Text,
                    oho_date_og_registration.Text,
                    oho_place_of_registration.Text,
                    oho_tax.Text,
                    oho_insurace.Text,
                    oho_mngr_family.Text,
                    oho_mngr_name.Text,
                    oho_mngr_international_code.Text,
                    Convert.ToInt32(oho_mngr_sex.SelectedValue.ToString()),
                    Convert.ToInt32(oho_mngr_link_to_eduction.SelectedValue.ToString()),
                    oho_mngr_branch.Text,
                    oho_mngr_date_of_birth.Text,
                    oho_mngr_mobile.Text,
                    0, 0, 0, Convert.ToInt32(DropDownList1.SelectedValue.ToString()), doc_address.InnerXml,
                    Convert.ToInt32(cdpeig));

                idcode = cdpeig;

                frm_one_managers1.Update(idcode);
                frm_one_observers1.Update(idcode);
                frm_one_add_utilities1.update(idcode);
                frm_one_employers1.update(idcode);
                frm_one_equipments_in_hand1.update(idcode);
            }

            // reloading the image of Peigiri.......
            string ur = "http://" + Request.Url.Authority;
            for (int i = 0; (i + 1) < Request.Url.Segments.Length; i++)
            {
                ur += Request.Url.Segments[i];
            }
            string srf = ur;
            //ur = "http://*****:*****@"" + cmplurl);
            //websiteToImage.Generate();
            //ScriptManager.RegisterClientScriptBlock(this, Page.GetType(), "j01", "window.open('" + srf + "uploadedfiles/" + crf + "','_blank')", true);
            ScriptManager.RegisterClientScriptBlock(this, Page.GetType(), "j01", "window.open('" + ur + "','_blank');window.location.href=window.location.href;", true);

            //Response.Redirect(Request.Url.AbsoluteUri);
            //ScriptManager.RegisterStartupScript(this, this.GetType(), "j03", "alert('ثبت گردید');", true);
        }
        catch (Exception __e)
        {
            string errmsg = __e.Message;
            errmsg = errmsg.Replace("'", " ");
            new main_class().execute_command("insert into tbl_errors(e_err,e_uri) values ('" + errmsg + "','"+Request.Url.AbsoluteUri+"')");
            ScriptManager.RegisterStartupScript(this, this.GetType(), "j02", "alert('لطفا در ورود اطلاعات دقت کنید');", true);

        }
    }