public void GetUserInfo() { BKXPYServiceReference.BKXPY_UserTBWSSoapClient user = new BKXPYServiceReference.BKXPY_UserTBWSSoapClient("BKXPY_UserTBWSSoap"); //初始化参数 string PSW = "Mfj_zjz_01"; string UserName = "******"; DataTable tbUser = null; int intError = 0; user.GetUser_WS(PSW, UserName, ref tbUser, ref intError); if (intError == 1) { //读取表tbUser,获取用户表中的数据 OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); OleDbTransaction tran = conn.BeginTransaction(); Dal.Models.Organization OrgList = BLL.Organization.GetOrganizationByName(tbUser.Rows[0]["CorpName"].ToString(), conn, tran); if (OrgList != null && OrgList.OrganizationCode != "" && OrgList.OrganizationCode == tbUser.Rows[0]["CorpCode"].ToString()) { Response.Redirect("../Mutual/HomePage.aspx"); } else { Dal.Models.Organization organization = new Dal.Models.Organization(); organization.OrganizationName = tbUser.Rows[0]["CorpName"].ToString(); organization.OrganizationCode = tbUser.Rows[0]["CorpCode"].ToString(); organization.OrganizationAddress = tbUser.Rows[0]["LinkAddress"].ToString(); //organization.LegalPersonName = ""; organization.UserName = tbUser.Rows[0]["CorpName"].ToString(); organization.Password = BLL.SysConstant.GetAppSettings("DefaultPassword", conn, tran);; //organization.Linkman = ""; organization.TelephoneNumber = tbUser.Rows[0]["LinkPhone"].ToString(); //organization.MobileNumber = ""; //organization.EmailAddress = ""; //organization.Postcode = "" //organization.FaxNumber = ""; try { BLL.Organization.CreateOrganization(organization, 0, conn, tran); tran.Commit(); conn.Close(); conn.Dispose(); Response.Redirect("../Mutual/HomePage.aspx"); } catch (Exception) { tran.Rollback(); conn.Close(); conn.Dispose(); } } } else if (intError == 2) { //不存在该用户 } else if (intError == 3) { //返回失败 } }
public void InitPage(int id) { btnCreateUser.Visible = false; OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); Dal.Models.Organization organization = BLL.Organization.GetOrganizationByUser(id, conn); if (organization != null) { txtOrganizationID.Value = organization.OrganizationID.ToString(); txtOrganizationName.Text = organization.OrganizationName; txtOrganizationCode.Text = organization.OrganizationCode; txtOrganizationAddress.Text = organization.OrganizationAddress; txtLegalPersonName.Text = organization.LegalPersonName; txtLegalPersonIDNo.Text = organization.LegalPersonIDNo; txtLinkman.Text = organization.Linkman; txtTelephoneNumber.Text = organization.TelephoneNumber; txtMobileNumber.Text = organization.MobileNumber; txtEmailAddress.Text = organization.EmailAddress; txtPostcode.Text = organization.Postcode; txtFaxNumber.Text = organization.FaxNumber; txtUserName.Text = organization.UserName; //txtUserName.Enabled = false; //txtOrganizationCode.Enabled = false; txtOrganizationName.Enabled = false; } conn.Close(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //根据当前模板状态显示部件 Dal.Models.TemplateInfo tempInfo = (Dal.Models.TemplateInfo)Session["TemplateInfo"]; OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); //显示模板的当前编辑部分 //Page.Form.Controls[3].FindControl(tempInfo.Anchor).Visible = true; Dal.Models.Template_01_PublicBuilding tempPublicBuilding = BLL.Declaration.GetDeclarationData <Dal.Models.Template_01_PublicBuilding>(tempInfo.DeclarationID.Value, conn); Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(tempInfo.DeclarationID.Value, conn); //SetDropDownList(DesignCategory, BLL.SysConstant.GetConstantList("14", conn)); //SetDropDownList(InvestSource, BLL.SysConstant.GetConstantList("15", conn)); //SetDropDownList(DeclarationLevel, BLL.SysConstant.GetConstantList("04", conn)); //List<Dal.Models.SysConstant> lstDomesticOrAbord = BLL.SysConstant.GetConstantList("19", conn); //SetDropDownList(DomesticOrAbord1, lstDomesticOrAbord); //SetDropDownList(DomesticOrAbord2, lstDomesticOrAbord); //SetDropDownList(DomesticOrAbord3, lstDomesticOrAbord); //SetDropDownList(DomesticOrAbord4, lstDomesticOrAbord); //List<Dal.Models.SysConstant> lstCollaborativePhase = BLL.SysConstant.GetConstantList("20", conn); //SetDropDownList(CollaborativePhase1, lstCollaborativePhase); //CollaborativePhase1.Items.Insert(0, new ListItem("")); //SetDropDownList(CollaborativePhase2, lstCollaborativePhase); //CollaborativePhase2.Items.Insert(0, new ListItem("")); //SetDropDownList(CollaborativePhase3, lstCollaborativePhase); //CollaborativePhase3.Items.Insert(0, new ListItem("")); //SetDropDownList(CollaborativePhase4, lstCollaborativePhase); //CollaborativePhase4.Items.Insert(0, new ListItem("")); //为控件赋值 BLL.Common.SetData <Dal.Models.Template_01_PublicBuilding>(tempPublicBuilding, Page); // 设置参与人员 //ucParticipant.ParticipantList = BLL.Declaration.GetParticipant(tempInfo.DeclarationID.Value, conn); Dal.Models.Organization org = BLL.Organization.GetOrganization(decl.OrganizationID.Value, conn); //DeclarationName.Text = decl.DeclarationName; DeclarationUnit.Text = org.OrganizationName; //PostalAddress.Text = org.OrganizationAddress; //Linkman.Text = org.Linkman; //TelephoneNumber.Text = org.TelephoneNumber; //FaxNumber.Text = org.FaxNumber; //MobileNumber.Text = org.MobileNumber; //Postcode.Text = org.Postcode; //EmailAddress.Text = Request.QueryString["id"];//org.EmailAddress conn.Close(); } }
protected void Page_Load(object sender, EventArgs e) { string strPara = Request["para"]; string str = BLL.Encryption.Decrypt(strPara); Dal.Models.Organization org = JsonConvert.DeserializeObject <Dal.Models.Organization>(str); litMessage.Text = "<b>当前网站:评优系统</b><br/><br/>" + str; GetUserInfo(); }
public static Dal.Models.UserInfo GetUserInfo(string strLoginName, OleDbConnection conn, OleDbTransaction tran = null) { string strSql = "select * from Users u "; strSql += "left join Expert e on e.UserID = u.UserID "; strSql += "left join Organization o on o.UserID = u.UserID "; strSql += "where u.UserName = ? or u.Email = ? or e.ExpertName = ? or e.IDNumber = ? or o.OrganizationName = ? or o.OrganizationCode = ? or o.UnifiedCode = ?"; IDataReader reader = Dal.OleDbHlper.ExecuteReader(strSql, conn, CommandType.Text, tran , new OleDbParameter("@UserName", OleDbType.VarWChar) { Value = strLoginName } , new OleDbParameter("@Email", OleDbType.VarWChar) { Value = strLoginName } , new OleDbParameter("@ExpertName", OleDbType.VarWChar) { Value = strLoginName } , new OleDbParameter("@IDNumber", OleDbType.VarWChar) { Value = strLoginName } , new OleDbParameter("@OrganizationName", OleDbType.VarWChar) { Value = strLoginName } , new OleDbParameter("@OrganizationCode", OleDbType.VarWChar) { Value = strLoginName } , new OleDbParameter("@UnifiedCode", OleDbType.VarWChar) { Value = strLoginName }); Dal.Models.UserInfo user = Dal.Models.BaseEntity.GetEntity <Dal.Models.UserInfo>(reader); if (user != null && user.UserType == "0806") { Dal.Models.Organization org = BLL.Organization.GetOrganizationByUser(user.UserID.Value, conn, tran); user.OrganizationName = org.OrganizationName; } return(user); }
public void btnCreateUser_click(object sender, EventArgs e) { OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); Dal.Models.UserInfo CreateUser = (Dal.Models.UserInfo)Session["UserInfo"]; Dal.Models.Organization organization = new Dal.Models.Organization(); organization.OrganizationName = txtOrganizationName.Text.Trim(); organization.Password = BLL.SysConstant.GetAppSettings("DefaultPassword", conn); organization.OrganizationCode = txtOrganizationCode.Text.Trim(); organization.OrganizationAddress = txtOrganizationAddress.Text.Trim(); organization.LegalPersonName = txtLegalPersonName.Text.Trim(); organization.UserName = txtUserName.Text.Trim(); organization.Linkman = txtLinkman.Text.Trim(); organization.TelephoneNumber = txtTelephoneNumber.Text.Trim(); organization.MobileNumber = txtMobileNumber.Text.Trim(); organization.EmailAddress = txtEmailAddress.Text.Trim(); organization.Postcode = txtPostcode.Text.Trim(); organization.FaxNumber = txtFaxNumber.Text.Trim(); if (!string.IsNullOrEmpty(organization.LegalPersonIDNo) && !BLL.IDOperation.CheckIDCard18(organization.LegalPersonIDNo)) { hdMsg.Value = "法人身份证号错误,请重新核对!"; conn.Close(); return; } OleDbTransaction tran = conn.BeginTransaction(); try { BLL.Organization.CreateOrganization(organization, CreateUser.UserID.Value, conn, tran); tran.Commit(); hdMsg.Value = "添加成功!"; } catch (Exception ex) { hdMsg.Value = ex.Message; tran.Rollback(); } conn.Close(); conn.Dispose(); }
public void btnEditUser_click(object sender, EventArgs e) { OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); Dal.Models.Organization organization = BLL.Organization.GetOrganization(Convert.ToInt32(txtOrganizationID.Value.Trim()), conn); organization.OrganizationName = txtOrganizationName.Text.Trim(); organization.OrganizationCode = txtOrganizationCode.Text.Trim(); organization.OrganizationAddress = txtOrganizationAddress.Text.Trim(); organization.LegalPersonName = txtLegalPersonName.Text.Trim(); organization.UserName = txtUserName.Text.Trim(); organization.LegalPersonIDNo = txtLegalPersonIDNo.Text.Trim(); organization.Linkman = txtLinkman.Text.Trim(); organization.TelephoneNumber = txtTelephoneNumber.Text.Trim(); organization.MobileNumber = txtMobileNumber.Text.Trim(); organization.EmailAddress = txtEmailAddress.Text.Trim(); organization.Postcode = txtPostcode.Text.Trim(); organization.FaxNumber = txtFaxNumber.Text.Trim(); if (!string.IsNullOrEmpty(organization.LegalPersonIDNo) && !BLL.IDOperation.CheckIDCard18(organization.LegalPersonIDNo)) { hdMsg.Value = "法人身份证号错误,请重新核对!"; conn.Close(); return; } OleDbTransaction tran = conn.BeginTransaction(); try { BLL.Organization.UpdateOrganization(organization, conn, tran); tran.Commit(); hdMsg.Value = "修改成功!"; } catch (Exception ex) { hdMsg.Value = ex.Message; tran.Rollback(); } conn.Close(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["ActivityType"] == null || Session["UserInfo"] == null) { Response.Redirect("../Mutual/UserEntry.aspx"); return; } if (!IsPostBack) { //根据当前模板状态显示部件 //Dal.Models.TemplateInfo tempInfo = (Dal.Models.TemplateInfo)Session["TemplateInfo"]; Dal.Models.TemplateInfo tempInfo = null; try { tempInfo = ((Declaration)Context.Handler).TempInfo; } catch { Response.Redirect("../Mutual/UserEntry.aspx"); } if (tempInfo == null) { Response.Redirect("../Mutual/UserEntry.aspx"); } OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); //显示模板的当前编辑部分 //divfather.FindControl(tempInfo.Anchor).Visible = true; Dal.Models.Template_10_CivilAirDefence tempCivilAirDefence = BLL.Declaration.GetDeclarationData <Dal.Models.Template_10_CivilAirDefence>(tempInfo.DeclarationID.Value, conn); Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(tempInfo.DeclarationID.Value, conn); SetDropDownList(DesignCategory, BLL.SysConstant.GetConstantList("14", conn)); SetDropDownList(InvestSource, BLL.SysConstant.GetConstantList("15", conn)); SetDropDownList(ProfessionalCategories, BLL.SysConstant.GetConstantList("28", conn)); //SetDropDownList(DeclarationLevel, BLL.SysConstant.GetConstantList("04", conn)); List <Dal.Models.SysConstant> lstDomesticOrAbord = BLL.SysConstant.GetConstantList("19", conn); SetDropDownList(DomesticOrAbord1, lstDomesticOrAbord); SetDropDownList(DomesticOrAbord2, lstDomesticOrAbord); SetDropDownList(DomesticOrAbord3, lstDomesticOrAbord); SetDropDownList(DomesticOrAbord4, lstDomesticOrAbord); List <Dal.Models.SysConstant> lstCollaborativePhase = BLL.SysConstant.GetConstantList("20", conn); SetDropDownList(CollaborativePhase01, lstCollaborativePhase); CollaborativePhase01.Items.Insert(0, new ListItem("")); SetDropDownList(CollaborativePhase02, lstCollaborativePhase); CollaborativePhase02.Items.Insert(0, new ListItem("")); SetDropDownList(CollaborativePhase03, lstCollaborativePhase); CollaborativePhase03.Items.Insert(0, new ListItem("")); SetDropDownList(CollaborativePhase04, lstCollaborativePhase); CollaborativePhase04.Items.Insert(0, new ListItem("")); //为控件赋值 BLL.Common.SetData <Dal.Models.Template_10_CivilAirDefence>(tempCivilAirDefence, divfather); // 设置参与人员 ucParticipant.ParticipantList = BLL.Declaration.GetParticipant(tempInfo.DeclarationID.Value, conn); Dal.Models.Organization org = BLL.Organization.GetOrganization(decl.OrganizationID.Value, conn); DeclarationName.Text = decl.DeclarationName; DeclarationUnit.Text = org.OrganizationName; PostalAddress.Text = org.OrganizationAddress; Linkman.Text = org.Linkman; TelephoneNumber.Text = org.TelephoneNumber; FaxNumber.Text = org.FaxNumber; MobileNumber.Text = org.MobileNumber; Postcode.Text = org.Postcode; EmailAddress.Text = org.EmailAddress;;//org.EmailAddress txtDeclarationID.Text = decl.DeclarationID.ToString(); txtTemplate.Text = tempInfo.TemplateCode; ucLegalStates.Org = org; ucLegalStates.Decl = decl; ucCertificate.Org = org; ucCertificate.Decl = decl; ucParticipant.Org = org; ucParticipant.Decl = decl; ucComments.Org = org; ucComments.Decl = decl; //接受登录人员 Dal.Models.UserInfo userInfo = (Dal.Models.UserInfo)Session["UserInfo"]; txtUser.Text = userInfo.UserType; //接受场景 if (!string.IsNullOrEmpty(tempInfo.Situation.ToString())) { txtSituation.Text = tempInfo.Situation.ToString(); } if (tempInfo.Situation.ToString() == "Declara") { string strActivityType = Session["ActivityType"].ToString(); // 获取指定活动类型的当前激活活动 Dal.Models.Activity actActivated = BLL.Activity.GetActivity(strActivityType, conn); if (actActivated == null) { conn.Close(); Response.Redirect("../Mutual/UserEntry.aspx"); return; } int iActivity = actActivated.ActivityID.Value; string strSpecialty = decl.DeclarationCode.Substring(4, 6); Dal.Models.Specialty dSpecialty = BLL.Specialty.GetSpecialtyByCode(strSpecialty, iActivity, conn); conn.Close(); nav02.InnerText = dSpecialty.SpecialtyName; } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["ActivityType"] == null || Session["UserInfo"] == null) { Response.Redirect("../Mutual/UserEntry.aspx"); return; } if (!IsPostBack) { //根据当前模板状态显示部件 // Dal.Models.TemplateInfo tempInfo = (Dal.Models.TemplateInfo)Session["TemplateInfo"]; Dal.Models.TemplateInfo tempInfo = null; try { tempInfo = ((Declaration)Context.Handler).TempInfo; } catch { Response.Redirect("../Mutual/UserEntry.aspx"); } if (tempInfo == null) { Response.Redirect("../Mutual/UserEntry.aspx"); } OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); //显示模板的当前编辑部分 //divfather.FindControl(tempInfo.Anchor).Visible = true; Dal.Models.Template_17_Standard tempStandard = BLL.Declaration.GetDeclarationData <Dal.Models.Template_17_Standard>(tempInfo.DeclarationID.Value, conn); Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(tempInfo.DeclarationID.Value, conn); ListItem item = new ListItem(); item.Text = "行业"; item.Value = "2401"; ListItem item2 = new ListItem(); item2.Text = "地方"; item2.Value = "2402"; ListItem item3 = new ListItem(); item3.Text = "国家"; item3.Value = "2403"; ListItem item4 = new ListItem(); item4.Text = "其他"; item4.Value = "2404"; ProjectSource.Items.Add(item); ProjectSource.Items.Add(item2); ProjectSource.Items.Add(item3); ProjectSource.Items.Add(item4); //为控件赋值 BLL.Common.SetData <Dal.Models.Template_17_Standard>(tempStandard, divfather); if (FileCatalog.Text == "") { FileCatalog.Text = BLL.SysConstant.GetTemplateConstant(tempInfo.TemplateCode, "FileCatalogDefaultText", conn); } // 设置参与人员 ucParticipant.ParticipantList = BLL.Declaration.GetParticipant(tempInfo.DeclarationID.Value, conn); Dal.Models.Organization org = BLL.Organization.GetOrganization(decl.OrganizationID.Value, conn); StandardName.Text = decl.DeclarationName; ChiefEditorUnit.Text = org.OrganizationName; PostalAddress.Text = org.OrganizationAddress; Linkman.Text = org.Linkman; TelephoneNumber.Text = org.TelephoneNumber; FaxNumber.Text = org.FaxNumber; MobileNumber.Text = org.MobileNumber; Postcode.Text = org.Postcode; EmailAddress.Text = org.EmailAddress;;//org.EmailAddress txtDeclarationID.Text = decl.DeclarationID.ToString(); txtTemplate.Text = tempInfo.TemplateCode; ucLegalStates.Org = org; ucLegalStates.Decl = decl; ucCertificate.Org = org; ucCertificate.Decl = decl; ucParticipant.Org = org; ucParticipant.Decl = decl; ucComments.Org = org; ucComments.Decl = decl; //接受登录人员 Dal.Models.UserInfo userInfo = (Dal.Models.UserInfo)Session["UserInfo"]; txtUser.Text = userInfo.UserType; //接受场景 if (!string.IsNullOrEmpty(tempInfo.Situation.ToString())) { txtSituation.Text = tempInfo.Situation.ToString(); } if (tempInfo.Situation.ToString() == "Declara") { string strActivityType = Session["ActivityType"].ToString(); // 获取指定活动类型的当前激活活动 Dal.Models.Activity actActivated = BLL.Activity.GetActivity(strActivityType, conn); if (actActivated == null) { conn.Close(); Response.Redirect("../Mutual/UserEntry.aspx"); return; } int iActivity = actActivated.ActivityID.Value; string strSpecialty = decl.DeclarationCode.Substring(4, 6); Dal.Models.Specialty dSpecialty = BLL.Specialty.GetSpecialtyByCode(strSpecialty, iActivity, conn); conn.Close(); nav02.InnerText = dSpecialty.SpecialtyName; } //string sourceText = ProjectSource.SelectedItem.Text; //ProjectSource.Text = sourceText; } }
public void SetOrgInfo(Dal.Models.Organization org, Dal.Models.Declaration decl) { }
protected void Page_Load(object sender, EventArgs e) { if (Session["ActivityType"] == null || Session["UserInfo"] == null) { Response.Redirect("../Common/Login.aspx"); return; } if (!IsPostBack) { //根据当前模板状态显示部件 //Dal.Models.TemplateInfo tempInfo = (Dal.Models.TemplateInfo)Session["TemplateInfo"]; Dal.Models.TemplateInfo tempInfo = null; try { tempInfo = ((Declaration)Context.Handler).TempInfo; } catch { Response.Redirect("../Mutual/UserEntry.aspx"); } if (tempInfo == null) { Response.Redirect("../Mutual/UserEntry.aspx"); } OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); //显示模板的当前编辑部分 Template_18_WaterSystem //divfather.FindControl(tempInfo.Anchor).Visible = true; Dal.Models.Template_18_WaterSystem tempTraditionalBuilding = BLL.Declaration.GetDeclarationData <Dal.Models.Template_18_WaterSystem>(tempInfo.DeclarationID.Value, conn); Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(tempInfo.DeclarationID.Value, conn); SetDropDownList(DeclarationCategory, BLL.SysConstant.GetConstantList("33", conn)); //为控件赋值 BLL.Common.SetData <Dal.Models.Template_18_WaterSystem>(tempTraditionalBuilding, divfather); // 设置参与人员 ucParticipant.ParticipantList = BLL.Declaration.GetParticipant(tempInfo.DeclarationID.Value, conn); Dal.Models.Organization org = BLL.Organization.GetOrganization(decl.OrganizationID.Value, conn); DeclarationName.Text = decl.DeclarationName; UseDeclarationName.Text = decl.DeclarationName; ConstructionDeclarationName.Text = decl.DeclarationName; DeclarationUnit.Text = org.OrganizationName; PostalAddress.Text = org.OrganizationAddress; Linkman.Text = org.Linkman; TelephoneNumber.Text = org.TelephoneNumber; FaxNumber.Text = org.FaxNumber; MobileNumber.Text = org.MobileNumber; Postcode.Text = org.Postcode; EmailAddress.Text = org.EmailAddress;;//org.EmailAddress txtDeclarationID.Text = decl.DeclarationID.ToString(); txtTemplate.Text = tempInfo.TemplateCode; ucLegalStates.Org = org; ucLegalStates.Decl = decl; ucCertificate.Org = org; ucCertificate.Decl = decl; ucParticipant.Org = org; ucParticipant.Decl = decl; ucComments.Org = org; ucComments.Decl = decl; //接受登录人员 Dal.Models.UserInfo userInfo = (Dal.Models.UserInfo)Session["UserInfo"]; txtUser.Text = userInfo.UserType; //接受场景 if (!string.IsNullOrEmpty(tempInfo.Situation.ToString())) { txtSituation.Text = tempInfo.Situation.ToString(); } if (tempInfo.Situation.ToString() == "Declara") { string strActivityType = Session["ActivityType"].ToString(); // 获取指定活动类型的当前激活活动 Dal.Models.Activity actActivated = BLL.Activity.GetActivity(strActivityType, conn); if (actActivated == null) { conn.Close(); Response.Redirect("../Common/Login.aspx"); return; } int iActivity = actActivated.ActivityID.Value; string strSpecialty = decl.DeclarationCode.Substring(4, 6); Dal.Models.Specialty dSpecialty = BLL.Specialty.GetSpecialtyByCode(strSpecialty, iActivity, conn); conn.Close(); nav02.InnerText = dSpecialty.SpecialtyName; } } }
protected void Page_Load(object sender, EventArgs e) { Dal.Models.UserInfo user = (Dal.Models.UserInfo)Session["UserInfo"]; if (user == null) { Response.Redirect("~/View/Mutual/UserEntry.aspx"); } if (!IsPostBack) { btnNext.Attributes.Add("OnClick", "return UserAddVerify()"); // 设定专业 Dal.Models.Specialty spec = null; Dal.Models.Prize prize = null; OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString); conn.Open(); string strActivityType = Request.Cookies["ActivityType"].Value; Dal.Models.Activity actActivated = BLL.Activity.GetActivity(strActivityType, conn); if (actActivated == null) { hdMsg.Value = "当前活动已关闭,请联系活动管理人员!"; return; } // 设置推荐协会 if (ConfigurationManager.AppSettings["ActivityType"] != "0102") { RecommendationAssociation.Visible = false; } else { List <Dal.Models.UserInfo> lstAssociation = BLL.User.GetlstAssociationUser(conn); ChooseAssociation.DataSource = lstAssociation; ChooseAssociation.DataTextField = "UserName"; ChooseAssociation.DataValueField = "UserID"; ChooseAssociation.DataBind(); } int iDeclarationID = 0; int.TryParse(Request["DeclarationID"], out iDeclarationID); hdDeclarationID.Value = iDeclarationID.ToString(); Dal.Models.Declaration decl = BLL.Declaration.GetDeclaration(iDeclarationID, conn); if (decl == null) { // 获取菜单传递过来的参数 spec = BLL.Specialty.GetSpecialty(actActivated.ActivityID.Value, Request["SepcCode"], conn); if (spec == null) { List <Dal.Models.Specialty> lst = BLL.Specialty.GetSpecialtyList(actActivated.ActivityID.Value, true, conn); spec = lst[0]; } // 设定封页台头 litTitle.Text = BLL.SysConstant.GetConstant(spec.TemplateCode, conn).ConstantDiscription; // 设定奖项列表 List <Dal.Models.Specialty> lstSpecialty = BLL.Specialty.GetDirectlyChildList(spec.SpecialtyID.Value, conn); List <Dal.Models.Prize> lstPrize = null; if (lstSpecialty.Count == 0) { lblSpecil.Visible = false; ddlSpecialty.Visible = false; ddlChildSpecialty.Visible = false; // 设定奖项列表 lstPrize = BLL.Prize.GetPrizeList(spec.SpecialtyID.Value, conn); } else { ddlSpecialty.Visible = true; List <Dal.Models.Specialty> lstChildSpecialty = null; lstSpecialty = lstSpecialty.Where(s => BLL.Prize.Count(s.SpecialtyID.Value, conn) > 0 || BLL.Specialty.Count(actActivated.ActivityID.Value, s.SpecialtyID, conn) > 0 ).ToList(); ddlSpecialty.DataSource = lstSpecialty; ddlSpecialty.DataTextField = "SpecialtyName"; ddlSpecialty.DataValueField = "SpecialtyID"; ddlSpecialty.DataBind(); ddlSpecialty.SelectedIndex = 0; if (lstSpecialty.Count > 0) { lstChildSpecialty = BLL.Specialty.GetDirectlyChildList(lstSpecialty[0].SpecialtyID.Value, conn); if (lstChildSpecialty.Count == 0) { ddlChildSpecialty.Visible = false; // 设定奖项列表 lstPrize = BLL.Prize.GetPrizeList(lstSpecialty[0].SpecialtyID.Value, conn); } else { ddlChildSpecialty.Visible = true; ddlChildSpecialty.DataSource = lstChildSpecialty; ddlChildSpecialty.DataTextField = "SpecialtyName"; ddlChildSpecialty.DataValueField = "SpecialtyID"; ddlChildSpecialty.DataBind(); ddlSpecialty.SelectedIndex = 0; // 设定奖项列表 lstPrize = BLL.Prize.GetPrizeList(lstChildSpecialty[0].SpecialtyID.Value, conn); } } } if (lstPrize != null && lstPrize.Count > 0) { // 绑定奖项列表 rdlPrize.DataSource = lstPrize; rdlPrize.DataTextField = "PrizeName"; rdlPrize.DataValueField = "PrizeID"; rdlPrize.DataBind(); rdlPrize.SelectedIndex = 0; // 根据奖项获取模版 string strTempCode = lstPrize.Where(p => p.PrizeID.Value == Convert.ToInt32(rdlPrize.SelectedValue)).ToList()[0].TemplateCode; Dal.Models.Organization org = BLL.User.GetOrganization(user.UserID.Value, conn); // 绑定导入数据 List <Dal.Models.Declaration> lstDeclaration = BLL.Declaration.GetDeclarationList(user, actActivated.ActivityID.Value, conn); lstDeclaration = lstDeclaration.Where(d => d.PrizeID == lstPrize[0].PrizeID).ToList(); if (lstDeclaration.Count() > 0) { ImportDeclarationData.DataSource = lstDeclaration; ImportDeclarationData.DataTextField = "DeclarationName"; ImportDeclarationData.DataValueField = "DeclarationID"; ImportDeclarationData.DataBind(); ImportDeclarationData.Items.Insert(0, new ListItem("<-- 不导入 -->", "0")); ImportDeclarationData.SelectedIndex = 0; } else { ImportData.Visible = false; } if (org != null) { // 设定单位信息 txtOrganizationName.Text = org.OrganizationName; } txtDeclarateDate.Text = DateTime.Today.ToString("yyyy-MM-dd"); } else { hdMsg.Value = "该专业下暂无奖项,无法申报!"; return; } } else { // 隐藏控件 ddlSpecialty.Visible = false; ddlChildSpecialty.Visible = false; lblSpecil.Visible = false; prize = BLL.Prize.GetPrize(decl.PrizeID.Value, conn); spec = BLL.Specialty.GetSpecialty(prize.SpecialtyID.Value, conn); ViewState["DeclarationID"] = decl.DeclarationID.Value; // 设定封页台头 litTitle.Text = BLL.SysConstant.GetConstant(prize.TemplateCode, conn).ConstantDiscription; // 设定封页台头 txtProjectName.Text = decl.DeclarationName; txtDeclarateDate.Text = decl.DeclareDate.Value.ToString("yyyy-MM-dd"); Dal.Models.Organization org = BLL.User.GetOrganization(decl.UserID.Value, conn); if (org != null) { // 设定单位信息 txtOrganizationName.Text = org.OrganizationName; } // 设定奖项列表 List <Dal.Models.Prize> lstPrize = BLL.Prize.GetPrizeList(spec.SpecialtyID.Value, conn); foreach (Dal.Models.Prize item in lstPrize) { rdlPrize.Items.Add(new System.Web.UI.WebControls.ListItem( item.PrizeName, item.PrizeID.Value.ToString()) { Enabled = item.TemplateCode == prize.TemplateCode }); } rdlPrize.SelectedValue = prize.PrizeID.Value.ToString(); if (decl.RecommendFrom == null || decl.RecommendFrom == "0" || decl.RecommendFrom == "") { ChooseAssociation.SelectedValue = "0"; litChooseAssociation.Text = "未有推荐协会"; } else { ChooseAssociation.SelectedValue = decl.RecommendFrom.ToString(); litChooseAssociation.Text = BLL.User.GetUserInfo(Convert.ToInt32(decl.RecommendFrom), conn).UserName; } // 隐藏导入数据控件 ImportData.Visible = false; // 生成二维码 //string imgUrl = BLL.Declaration.CreatQRcode(decl.DeclarationCode, conn); //// 显示二维码 //HtmlTableRow tr = new HtmlTableRow(); //HtmlTableCell td1 = new HtmlTableCell("td"); //HtmlTableCell td2 = new HtmlTableCell("td"); //td1.InnerHtml = "<label style='margin-top: 20px;'>二维码:</label>"; //td1.Style.Add("width", "30%"); //td2.InnerHtml = "<img src='../../Content/Temp/" + decl.DeclarationCode + "/QRcode" + decl.DeclarationCode + ".jpg' style='width:150px;height:150px;' />"; //td2.ColSpan = 2; //tr.Cells.Add(td1); //tr.Cells.Add(td2); //tbInformation.Rows.Add(tr); } //接受场景 if (!string.IsNullOrEmpty(Request["Situation"])) { txtSituation.Text = Request["Situation"].Replace("'", ""); litProjectName.Text = decl.DeclarationName; litDeclarateDate.Text = decl.DeclareDate.Value.ToString("yyyy-MM-dd"); litrdlPrize.Text = prize.PrizeName; } conn.Close(); } }
public static int UpdateOrganization(Dal.Models.Organization organization, OleDbConnection conn, OleDbTransaction tran = null) { StringBuilder sbSql = new StringBuilder(); sbSql.Append(" update Organization set "); sbSql.Append(" OrganizationName = ? , "); sbSql.Append(" Abbreviation = ? , "); sbSql.Append(" UnifiedCode = ?, "); sbSql.Append(" OrganizationCode = ?, "); sbSql.Append(" OrganizationAddress = ?, "); sbSql.Append(" LegalPersonName = ?, "); sbSql.Append(" LegalPersonIDNo = ?, "); sbSql.Append(" Linkman = ?, "); sbSql.Append(" MobileNumber = ?, "); sbSql.Append(" TelephoneNumber = ?, "); sbSql.Append(" Postcode = ?, "); sbSql.Append(" FaxNumber = ?, "); sbSql.Append(" EmailAddress = ?, "); sbSql.Append(" LastUpdateTime = ? "); sbSql.Append(" where OrganizationID = ? ;"); sbSql.Append(" update Users set UserName= ?, Email = ? where UserID = ? "); return(Dal.OleDbHlper.ExecuteNonQuery(sbSql.ToString(), conn, CommandType.Text, tran , new OleDbParameter("@OrganizationName", OleDbType.VarWChar) { Value = organization.OrganizationName } , new OleDbParameter("@Abbreviation", OleDbType.VarWChar) { Value = organization.Abbreviation } , new OleDbParameter("@UnifiedCode", OleDbType.VarWChar) { Value = organization.UnifiedCode } , new OleDbParameter("@OrganizationCode", OleDbType.VarWChar) { Value = organization.OrganizationCode } , new OleDbParameter("@OrganizationAddress", OleDbType.VarWChar) { Value = organization.OrganizationAddress } , new OleDbParameter("@LegalPersonName", OleDbType.VarWChar) { Value = organization.LegalPersonName } , new OleDbParameter("@LegalPersonIDNo", OleDbType.VarWChar) { Value = organization.LegalPersonIDNo } , new OleDbParameter("@Linkman", OleDbType.VarWChar) { Value = organization.Linkman } , new OleDbParameter("@MobileNumber", OleDbType.VarWChar) { Value = organization.MobileNumber } , new OleDbParameter("@TelephoneNumber", OleDbType.VarWChar) { Value = organization.TelephoneNumber } , new OleDbParameter("@Postcode", OleDbType.VarWChar) { Value = organization.Postcode } , new OleDbParameter("@FaxNumber", OleDbType.VarWChar) { Value = organization.FaxNumber } , new OleDbParameter("@EmailAddress", OleDbType.VarWChar) { Value = organization.EmailAddress } , new OleDbParameter("@LastUpdateTime", OleDbType.Date) { Value = DateTime.Now } , new OleDbParameter("@OrganizationID", OleDbType.Integer) { Value = organization.OrganizationID } , new OleDbParameter("@UserName", OleDbType.VarWChar) { Value = organization.UserName } , new OleDbParameter("@Email", OleDbType.VarWChar) { Value = organization.EmailAddress } , new OleDbParameter("@UserID", OleDbType.Integer) { Value = organization.UserID } )); }
public static int DeleteOrganization(int iOrganizationID, int iActivityID, OleDbConnection conn, OleDbTransaction trans = null) { Dal.Models.Organization org = GetOrganization(iOrganizationID, conn, trans); return(User.DeleteUser(org.UserID.Value, iActivityID, conn, trans)); }
public static int CreateOrganization(Dal.Models.Organization org, int iCurrentUserID, OleDbConnection conn, OleDbTransaction trans = null) { if (string.IsNullOrEmpty(org.OrganizationName) || string.IsNullOrEmpty(org.OrganizationCode)) { return(-1); } // 判断重名 if (GetOrganizationByName(org.OrganizationName, conn, trans) != null) { throw new Exception("单位名已存在!"); } if (IsSocialCreditCode(org.OrganizationCode)) { org.UnifiedCode = org.OrganizationCode; // 社会统一代码和组织机构代码对应关系: // 营业执照:全部号码 // 组织机构代码:第9位至倒数第2位,共9位数 // 税务登记证号码:第3位至倒数第2位,共15位数 org.OrganizationCode = org.UnifiedCode.Substring(9, 9); } //else //{ // if (!IsOrganizationCode(org.OrganizationCode)) // { // throw new Exception("组织机构代码或社会统一代码输入错误,请检查后再次输入!"); // } //} // 判断组织机构代码 if (GetOrganizationByCode(org.OrganizationCode, conn, trans) != null) { throw new Exception("组织机构代码已存在!"); } if (org.CreateTime == null || org.LastUpdateTime == null) { org.CreateTime = DateTime.Now; org.LastUpdateTime = org.CreateTime; } Dal.Models.UserInfo user = new Dal.Models.UserInfo(); user.UserName = string.IsNullOrEmpty(org.UserName) ? org.OrganizationName : org.UserName; //org.Password; //user.DefaultPassword; user.Password = string.IsNullOrEmpty(org.UnifiedCode) ? org.OrganizationCode : org.UnifiedCode; user.Email = org.EmailAddress; user.UserStatus = "0701"; user.UserType = "0806"; user.CreateTime = org.CreateTime; user.LastUpdateTime = org.CreateTime; user.CreateUser = iCurrentUserID; user.IsPasswordChanged = false; // 创建用户 int iResult = User.CreateUser(user, conn, trans); if (iResult <= 0) { return(iResult); } string strPwd = BLL.SysConstant.GetAppSettings("DefaultPassword", conn, trans); BLL.User.ResetPassword(iResult, strPwd, conn, trans); user.UserID = iResult; StringBuilder sbSql = new StringBuilder(); sbSql.Append(" INSERT INTO Organization( "); sbSql.Append(" UserID "); sbSql.Append(" ,OrganizationName "); sbSql.Append(" ,Abbreviation "); sbSql.Append(" ,UnifiedCode "); sbSql.Append(" ,OrganizationCode "); sbSql.Append(" ,OrganizationAddress "); sbSql.Append(" ,LegalPersonName "); sbSql.Append(" ,LegalPersonIDNo "); sbSql.Append(" ,Linkman "); sbSql.Append(" ,MobileNumber "); sbSql.Append(" ,TelephoneNumber "); sbSql.Append(" ,Postcode "); sbSql.Append(" ,FaxNumber "); sbSql.Append(" ,EmailAddress "); sbSql.Append(" ,CreateTime "); sbSql.Append(" ,LastUpdateTime "); sbSql.Append(" ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) "); iResult = Dal.OleDbHlper.ExecuteNonQuery(sbSql.ToString(), conn, CommandType.Text, trans , new OleDbParameter("@UserID", OleDbType.Integer) { Value = user.UserID } , new OleDbParameter("@OrganizationName", OleDbType.VarWChar) { Value = org.OrganizationName } , new OleDbParameter("@Abbreviation", OleDbType.VarWChar) { Value = org.Abbreviation } , new OleDbParameter("@UnifiedCode", OleDbType.VarWChar) { Value = org.UnifiedCode } , new OleDbParameter("@OrganizationCode", OleDbType.VarWChar) { Value = org.OrganizationCode } , new OleDbParameter("@OrganizationAddress", OleDbType.VarWChar) { Value = org.OrganizationAddress } , new OleDbParameter("@LegalPersonName", OleDbType.VarWChar) { Value = org.LegalPersonName } , new OleDbParameter("@LegalPersonIDNo", OleDbType.VarWChar) { Value = org.LegalPersonIDNo } , new OleDbParameter("@Linkman", OleDbType.VarWChar) { Value = org.Linkman } , new OleDbParameter("@MobileNumber", OleDbType.VarWChar) { Value = org.MobileNumber } , new OleDbParameter("@TelephoneNumber", OleDbType.VarWChar) { Value = org.TelephoneNumber } , new OleDbParameter("@Postcode", OleDbType.VarWChar) { Value = org.Postcode } , new OleDbParameter("@FaxNumber", OleDbType.VarWChar) { Value = org.FaxNumber } , new OleDbParameter("@EmailAddress", OleDbType.VarWChar) { Value = org.EmailAddress } , new OleDbParameter("@CreateTime", OleDbType.Date) { Value = org.CreateTime } , new OleDbParameter("@LastUpdateTime", OleDbType.Date) { Value = org.LastUpdateTime }); if (iResult > 0) { org = GetOrganizationByName(org.OrganizationName, conn, trans); iResult = org.OrganizationID.Value; } return(iResult); }
/// <summary> /// 导入会员单位 /// </summary> /// <param name="context"></param> /// <param name="conn"></param> public void ImportLeaguerUser(HttpContext context, OleDbConnection conn) { List <object> lstResult = new List <object>(); Dal.Models.UserInfo userinfo = (Dal.Models.UserInfo)context.Session["UserInfo"]; if (context.Request.Files.Count > 0) { string fileName = ""; HttpFileCollection files = context.Request.Files; for (int i = 0; i < files.Count; i++) { HttpPostedFile file = files[i]; if (!Directory.Exists(context.Server.MapPath("~/Content/Temp/ExcelTemp/"))) { Directory.CreateDirectory(context.Server.MapPath("~/Content/Temp/ExcelTemp/")); } fileName = context.Server.MapPath("~/Content/Temp/ExcelTemp/" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + file.FileName); file.SaveAs(fileName); } DataTable dtLeaguerUser = new DataTable(); Dal.Models.Organization org = new Dal.Models.Organization(); bool isColumnName = true; // 0 ..sheet1 dtLeaguerUser = BLL.Common.ReadExcelByNPOI(fileName, isColumnName, 0); List <Dal.Models.Organization> lstOrg = new List <Dal.Models.Organization>(); //创建单位, 如果创建失败,加入列表 List <KeyValuePair <string, Dal.Models.Organization> > lstError = new List <KeyValuePair <string, Dal.Models.Organization> >(); OleDbTransaction tran = conn.BeginTransaction(); foreach (DataRow row in dtLeaguerUser.Rows) { if (string.IsNullOrEmpty(row["单位名称"].ToString().Trim())) { continue; } org = new Dal.Models.Organization(); org.OrganizationName = row["单位名称"].ToString(); org.OrganizationCode = row["组织机构代码"].ToString(); org.UserName = row["登录账号"].ToString(); org.OrganizationAddress = row["单位地址"].ToString(); org.LegalPersonName = row["法人姓名"].ToString(); org.LegalPersonIDNo = row["法人身份证号"].ToString(); org.Linkman = row["联系人"].ToString(); org.TelephoneNumber = row["电话号码"].ToString(); org.MobileNumber = row["手机号"].ToString(); org.EmailAddress = row["电子邮箱"].ToString(); org.Postcode = row["邮政编码"].ToString(); org.FaxNumber = row["传真号"].ToString(); org.Password = BLL.SysConstant.GetAppSettings("DefaultPassword", conn, tran); try { // 校验身份证号 if (!string.IsNullOrEmpty(org.LegalPersonIDNo) && !BLL.IDOperation.CheckIDCard18(org.LegalPersonIDNo)) { throw new Exception("所输入的身份证号码不是有效身份证号码!"); } // 判断邮箱地址 if (!string.IsNullOrEmpty(org.EmailAddress) && !BLL.Common.IsValidEmail(org.EmailAddress)) { throw new Exception("电子邮件地址格式错误!"); } BLL.Organization.CreateOrganization(org, userinfo.UserID.Value, conn, tran); lstOrg.Add(org); } catch (Exception ex) { // 添加失败数据及失败原因 lstError.Add(new KeyValuePair <string, Dal.Models.Organization>(ex.Message, org)); } } tran.Commit(); lstResult.Add(dtLeaguerUser.Rows.Count); lstResult.Add(lstOrg.Count); lstResult.Add(lstOrg); lstResult.Add(lstError); context.Response.Write(JsonConvert.SerializeObject(lstResult)); } }