void GetData() { DAL.dbDataContext db = new DAL.dbDataContext(); DAL.CompanyInfo info = db.CompanyInfos.FirstOrDefault(); if (info == null) { return; } txt_name.Text = info.CompanyName; txt_address.Text = info.Address; txt_phone.Text = info.Phone; txt_mobile.Text = info.Mobile; }
void Save() { if (txt_name.Text.Trim() == String.Empty) { txt_name.ErrorText = "برجاء ادخال اسم الشركة"; return; } DAL.dbDataContext db = new DAL.dbDataContext(); DAL.CompanyInfo info = db.CompanyInfos.FirstOrDefault(); if (info == null) { info = new DAL.CompanyInfo(); } info.CompanyName = txt_name.Text; info.Mobile = txt_mobile.Text; info.Phone = txt_phone.Text; info.Address = txt_address.Text; db.SubmitChanges(); XtraMessageBox.Show("تم الحفظ بنجاح"); }
protected void Page_Load(object sender, EventArgs e) { //Session["UserName"] = "******"; //Session["UserType"] = "1"; if (Session["UserName"] == null || Session["UserType"] == null || Convert.ToInt32(Session["UserType"]) < 0 || Convert.ToInt32(Session["UserType"]) > 5) { Response.Write("<script>alert(\"请登录\");location.href = location.origin+\"/forms/publicforms/Login/Login.aspx\";</script>"); Response.End(); } if (Request["action"] != "" && Request["action"] != null) { if (Request["action"] == "AddData") { AddData(); } if (Request["action"] == "save") { save(); } if (Request["action"].ToString() == "check") { string username = Request["data"].ToString(); DAL.CompanyInfo du = new DAL.CompanyInfo(); if (DAL.CompanyInfo.Exists(username)) { Response.Clear(); Response.Write("1"); Response.End(); } else { Response.Clear(); Response.Write("0"); Response.End(); } } } if (!IsPostBack) { int companyCertifiationIndex = Convert.ToInt32(DAL.RegisterUser.GetModel(Session["UserName"].ToString()).CertifiationIndex); //根据注册用户的认证id索引加载页面信息 Model.CompanyInfo companyinfo = DAL.CompanyInfo.GetModel(companyCertifiationIndex); company_name.Value = companyinfo.Company; map_qualification_path_file_.Src = companyinfo.SurveyingFile; switch (companyinfo.Industry) { case "1": type_id.Value = "市内测绘资质单位"; break; case "2": type_id.Value = "政府机构"; break; case "3": type_id.Value = "仪器公司"; break; case "4": type_id.Value = "高校/科研院所"; break; case "5": type_id.Value = "其他非测绘资质执证单位"; break; case "6": type_id.Value = "市外测绘资质单位"; break; case "7": type_id.Value = "市外非测绘资质单位"; break; case "8": type_id.Value = "市内非测绘资质单位"; break; } maplevel.Value = companyinfo.SurveyingQualification; map_qualification_sn.Value = companyinfo.SurveyingNumber; corporate.Value = companyinfo.LegalPerson; corporate_tel.Value = companyinfo.CompanyTel; business_licence.Value = companyinfo.OrganizationCode; address.Value = companyinfo.Address; //business_licence_path_file_.Src = companyinfo.BusinessLicense; //corporate_id_card_front_file_.Src = companyinfo.LegalIDCardFile; //secrecy_agreement_path_file_.Src = companyinfo.ServiceAgreementFile; //client_authorization_path_file_.Src = companyinfo.PowerOfAttorney; contact_name.Value = companyinfo.Contact; //contact_phone.Value = companyinfo.CompanyTel; phone.Value = companyinfo.CompanyTel; //string res = cs.JSONHelper.ObjectToJSON(companyinfo); } }
protected void Page_Load(object sender, EventArgs e) { //Session["UserName"] = "******"; //Session["UserType"] = "1"; if (Session["UserName"] == null || Session["UserType"] == null || Convert.ToInt32(Session["UserType"]) < 0 || Convert.ToInt32(Session["UserType"]) > 5) { Response.Write("<script>alert(\"请登录\");location.href = location.origin+\"/forms/publicforms/Login/Login.aspx\";</script>"); Response.End(); } string UserName = Session["UserName"].ToString(); if (Request["action"] != null) { switch (Request["action"]) { case "AddData": //Response.ContentType = "text/plain"; AddData(); //Response.End(); break; case "verifycompanyform": Verifycompanyform(); break; case "company_judge": company_judge(Request["company_name"]); break; default: break; } if (Request["action"].ToString() == "check") { string username = Request["data"].ToString(); DAL.CompanyInfo du = new DAL.CompanyInfo(); if (DAL.CompanyInfo.Exists(username)) { Response.Clear(); Response.Write("0"); Response.End(); } else { Response.Clear(); Response.Write("1"); Response.End(); } } } if (DAL.RegisterUser.Exists(Session["UserName"].ToString())) { Model.RegisterUser registerUser = DAL.RegisterUser.GetModel(Session["UserName"].ToString()); if (registerUser.CertifiationStatus == 5) { try { Model.CompanyInfo companyInfo = DAL.CompanyInfo.GetModel(Convert.ToInt32(registerUser.CertifiationIndex)); company_name.Value = companyInfo.Company; map_level.Value = companyInfo.SurveyingQualification; map_qualification_sn.Value = companyInfo.SurveyingNumber; business_licence.Value = companyInfo.OrganizationCode; corporate.Value = companyInfo.LegalPerson; corporate_tel.Value = companyInfo.CompanyTel; province.SelectedIndex = 1; city.SelectedIndex = 1; town.SelectedIndex = 1; address.Value = companyInfo.Address; post_code.Value = ""; map_qualification_path_file_.Src = companyInfo.SurveyingFile; map_qualification_path = companyInfo.SurveyingFile; business_licence_path_file_.Src = companyInfo.BusinessLicense; business_licence_path = companyInfo.BusinessLicense; // corporate_id_card_front_file_.Src = companyInfo.LegalIDCardFile; //corporate_id_card_front = companyInfo.LegalIDCardFile; // operator_id_card_front_file_.Src = companyInfo.ContactIDCardFile; // operator_id_card_front = companyInfo.ContactIDCardFile; // client_authorization_path_file_.Src = companyInfo.PowerOfAttorney; // client_authorization_path = companyInfo.PowerOfAttorney; contact_name.Value = companyInfo.Contact; qcphone.Value = companyInfo.CompanyTel; //secrecy_agreement_path_file_.Src = companyInfo.ServiceAgreementFile; } catch { } } } }