protected void Initial(ref CY.CSTS.Core.Business.UnitInfo SingleTon, ref IEnumerable<CY.CSTS.Core.Business.UnitInfo> MultiTon) { try { IEnumerable<CY.CSTS.Core.Business.UnitInfo> unitInfos = CY.CSTS.Core.Business.UnitInfo.GetHotestUnitInfo(7).OrderByDescending(item => item.Count); if (unitInfos != null && unitInfos.Count() > 0) { SingleTon = unitInfos.First(); MultiTon = unitInfos.Skip(1).Take(unitInfos.Count() - 1); } } catch (Exception ex) { throw ex; } }
/// <summary> /// 初始化 /// </summary> private void Initial() { try { UnitTypes = InitUnitType(); CurrentUnit = InitUnitInfo(out SubCenters, out AssistUnits); } catch (Exception ex) { throw ex; } finally { } }
protected void bindCoorTable() { CY.CSTS.Core.Business.UnitInfo uinfo = new CY.CSTS.Core.Business.UnitInfo(); CY.CSTS.Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit sub = CY.CSTS.Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit.Load(idHistorySub); if (sub != null) { uinfo = CY.CSTS.Core.Business.UnitInfo.Load(sub.UintId); if (uinfo != null) { this.Title = uinfo.UnitName; lbCoorName.Text = uinfo.UnitName + "激励考评表"; } } IList<CY.CSTS.Core.Business.StimulationCriterionQuestion> stiQuaList = CY.CSTS.Core.Business.StimulationCriterionQuestion.GetAllStimulationCriterionQuestion(); for (int i = stiQuaList.Count - 1; i >= 0; i--) { if (stiQuaList[i].StimulationContentType != 2 || stiQuaList[i].Index > 12) { stiQuaList.RemoveAt(i); } } System.Web.UI.WebControls.Label lb; int totleScore = 0; for (int i = 0; i < stiQuaList.Count; i++) { CY.CSTS.Core.Business.StimulationCriterionAnswer ans = CY.CSTS.Core.Business.StimulationCriterionAnswer.GetAnseerByQuest(stiQuaList[i].Id, idHistorySub); if (ans != null) { totleScore += ans.Credit; lb = (System.Web.UI.WebControls.Label)tableDetail.FindControl("lbCoorRow" + (i + 1)); if (lb != null) { lb.Text = ans.Content; } } } lbScoreCoor.InnerText = totleScore.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (!string.IsNullOrEmpty(CY.Utility.Common.RequestUtility.GetQueryString("Id"))) { StoreViewState("id", CY.Utility.Common.RequestUtility.GetQueryString("Id")); } else { rpUnitAssistDataBing(); rpUnitCenterDataBind(); if (centerunits != null && centerunits.Count > 0) { currentUnit = centerunits.First(); currentUnitDataBind(currentUnit); } } CharDataBind(); ProduceJsonNArray(); ProduceChartId(); HiddenFieldDataBind(); RenderGrid(out stasticals); } }
protected Guid SaveFinalItemInDB(int flag) { //flag:0保存 3申请入网 CY.CSTS.Core.Business.UnitInfo unitInfo = new CY.CSTS.Core.Business.UnitInfo(); Guid DutyId = new Guid(); unitInfo.UnitName = tbTitle.Text; unitInfo.Alias = tbTitle.Text; unitInfo.UnitType = new Guid(ddlUnitType.SelectedValue); unitInfo.Ownership = tbOwnership.Text; unitInfo.DrtificialPerson = tbDrtificialPerson.Text; // 职务 if (ddlDutys.Text.Trim() != "") { List<CY.CSTS.Core.Business.Duty> postRankList = CY.CSTS.Core.Business.Duty.GetAllDuty() as List<CY.CSTS.Core.Business.Duty>; postRankList = postRankList.Where(Items => Items.Nmae == ddlDutys.Text.Trim()).ToList(); if (postRankList.Count == 0) { CY.CSTS.Core.Business.Duty post = new CY.CSTS.Core.Business.Duty(); post.Nmae = ddlDutys.Text.Trim(); post.Save(); DutyId = post.Id; } else { DutyId = postRankList[0].Id; } unitInfo.DrtificialPersonDutyID = DutyId; } unitInfo.LinkDepartdement = tbLinkDepartdement.Text; if (!string.IsNullOrEmpty(tbLinkMan.Text)) { unitInfo.Linkman = tbLinkMan.Text; if (!string.IsNullOrEmpty(ddlLinkManDuty.Text)) { // 职务 if (ddlLinkManDuty.Text.Trim() != "") { List<CY.CSTS.Core.Business.Duty> postRankList = CY.CSTS.Core.Business.Duty.GetAllDuty() as List<CY.CSTS.Core.Business.Duty>; postRankList = postRankList.Where(Items => Items.Nmae == ddlLinkManDuty.Text.Trim()).ToList(); if (postRankList.Count == 0) { CY.CSTS.Core.Business.Duty post = new CY.CSTS.Core.Business.Duty(); post.Nmae = ddlLinkManDuty.Text.Trim(); post.Save(); DutyId = post.Id; } else { DutyId = postRankList[0].Id; } unitInfo.LinkmanDutyID = DutyId; } } unitInfo.LinkmanTel = tbLinkmanTel.Text; } unitInfo.ChargeDepartMent = tbChargeDepartMent.Text; unitInfo.Synopsis = tbSynopsis.Text; unitInfo.InstrumentSection = tbInstrumentSection.Text; int Count = default(int); if (!string.IsNullOrEmpty(tbVindicatorCount.Text) && int.TryParse(tbVindicatorCount.Text, out Count)) { unitInfo.VindicatorCount = Count; } if (!string.IsNullOrEmpty(ddlSubjection.Text)) { unitInfo.Subjection = Convert.ToInt32(ddlSubjection.SelectedValue); } unitInfo.WorkCode = tbWorkCode.Text; unitInfo.Postalcode = tbZipCode.Text; unitInfo.Tel = tbTel.Text; unitInfo.Fax = tbFax.Text; unitInfo.Email = tbEmail.Text; if (!string.IsNullOrEmpty(ddlProvince.SelectedValue) && CY.Utility.Common.StringHelper.IsGuid(ddlProvince.SelectedValue.Trim())) { string TempName = ddlCity.ClientID.Replace("_","$"); unitInfo.ProvinceID = new Guid(ddlProvince.SelectedValue); if (Request.Form[TempName] != null && Request.Form[TempName] != "0") { unitInfo.CityID = new Guid(Request.Form.Get(TempName)); } } unitInfo.Address = tbAddress.Text; unitInfo.BankAccountName = tbBankAccountName.Text; unitInfo.BankName = tbBankName.Text; unitInfo.BankAccount = tbBankAccount.Text; unitInfo.Certificate = tbCertificate.Text; if (!string.IsNullOrEmpty(ddlTradeSort.SelectedValue) && CY.Utility.Common.StringHelper.IsGuid(ddlTradeSort.SelectedValue.Trim())) { unitInfo.TradeSortID = new Guid(ddlTradeSort.SelectedValue); } unitInfo.Website = tbWebSite.Text.Trim(); unitInfo.IsModification = Convert.ToInt32(ddlIsModification.SelectedValue); unitInfo.Rel_certificate = tbRel_certificate.Text; unitInfo.Operation = tbOperation.Text; unitInfo.Remark = tbRemark.Text; unitInfo.IsCooperantUnit = 1;//协作单位 unitInfo.AuditingState = flag; unitInfo.CreatDate = DateTime.Now; unitInfo.UpdateDate = DateTime.Now; unitInfo.UnitApplicationUserType = 1; CY.CSTS.Core.Business.User user = Session["User"] as CY.CSTS.Core.Business.User; int instructmentCount = default(int); if (!string.IsNullOrEmpty(tbInstructmentCount.Text) && int.TryParse(tbInstructmentCount.Text, out instructmentCount)) { unitInfo.InstrumentCount = instructmentCount; } if (user != null) { unitInfo.UnitInWorkPerson = user.Id; } unitInfo.Save(); return unitInfo.Id; }
protected void btnSave_Click(object sender, EventArgs e) { bool IsSucess = true; #region Required Field if (string.IsNullOrEmpty(tbTitle.Text) || CY.CSTS.Core.Business.UnitInfo.IsExist(tbTitle.Text)) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "script", "<script type='text/javascript'>alert('单位名称不能为空!或已经存在该名称!')</script>"); return; } CY.CSTS.Core.Business.UnitType unittype = null; if (string.IsNullOrEmpty(ddlUnitType.SelectedValue) || ddlUnitType.SelectedValue == "0" || !IsGuid(ddlUnitType.SelectedValue.Trim()) || (unittype = CY.CSTS.Core.Business.UnitType.Load(new Guid(ddlUnitType.SelectedValue.Trim()))) == null) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "script", "<script type='text/javascript'>alert('请选择单位类型!')</script>"); return; } if (string.IsNullOrEmpty(tbWorkCode.Text)) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "script", "<script type='text/javascript'>alert('组织机构代码不能为空!')</script>"); return; } if (string.IsNullOrEmpty(tbDrtificialPerson.Text)) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "script", "<script type='text/javascript'>alert('单位法人不能为空!')</script>"); return; } CY.CSTS.Core.Business.Duty duty = null; if (string.IsNullOrEmpty(ddlDutys.SelectedValue) || !CY.Utility.Common.StringHelper.IsGuid(ddlDutys.SelectedValue.Trim()) || (duty = CY.CSTS.Core.Business.Duty.Load(new Guid(ddlDutys.SelectedValue.Trim()))) == null) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "script", "<script type='text/javascript'>alert('法人职责不能为空!')</script>"); return; } if (string.IsNullOrEmpty(ddlSubjection.SelectedValue)) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "script", "<script type='text/javascript'>alert('上级单位不能为空!')</script>"); return; } #endregion try { int isCoperationOrSubCenter = default(int); if (int.TryParse(FetchViewState("unittype"), out isCoperationOrSubCenter) && isCoperationOrSubCenter > 0) { #region UnitInfo CY.CSTS.Core.Business.UnitInfo unitInfo = new CY.CSTS.Core.Business.UnitInfo(); unitInfo.UnitName = tbTitle.Text; unitInfo.Alias = tbTitle.Text; unitInfo.UnitType = new Guid(ddlUnitType.SelectedValue); unitInfo.Ownership = tbOwnership.Text; unitInfo.DrtificialPerson = tbDrtificialPerson.Text; unitInfo.DrtificialPersonDutyID = new Guid(ddlDutys.SelectedValue); unitInfo.LinkDepartdement = tbLinkDepartdement.Text; if (!string.IsNullOrEmpty(tbLinkMan.Text)) { unitInfo.Linkman = tbLinkMan.Text; if (!string.IsNullOrEmpty(ddlLinkManDuty.SelectedValue) && CY.Utility.Common.StringHelper.IsGuid(ddlLinkManDuty.SelectedValue.Trim())) { unitInfo.LinkmanDutyID = new Guid(ddlLinkManDuty.SelectedValue); } unitInfo.LinkmanTel = tbLinkmanTel.Text; } unitInfo.ChargeDepartMent = tbChargeDepartMent.Text; unitInfo.Synopsis = tbSynopsis.Text; unitInfo.InstrumentSection = tbInstrumentSection.Text; int Count = default(int); if (!string.IsNullOrEmpty(tbVindicatorCount.Text) && int.TryParse(tbVindicatorCount.Text, out Count)) { unitInfo.VindicatorCount = Count; } if (!string.IsNullOrEmpty(ddlSubjection.Text)) { unitInfo.Subjection = Convert.ToInt32(ddlSubjection.SelectedValue); } unitInfo.WorkCode = tbWorkCode.Text; unitInfo.Postalcode = tbZipCode.Text; unitInfo.Tel = tbTel.Text; unitInfo.Fax = tbFax.Text; unitInfo.Email = tbEmail.Text; if (!string.IsNullOrEmpty(ddlProvince.SelectedValue) && CY.Utility.Common.StringHelper.IsGuid(ddlProvince.SelectedValue.Trim())) { unitInfo.ProvinceID = new Guid(ddlProvince.SelectedValue); if (!string.IsNullOrEmpty(Request.Form.Get("ddlCity")) && CY.Utility.Common.StringHelper.IsGuid(ddlCity.SelectedValue.Trim())) { unitInfo.CityID = new Guid(Request.Form.Get("ddlCity")); } } unitInfo.Address = tbAddress.Text; unitInfo.BankAccountName = tbBankAccountName.Text; unitInfo.BankName = tbBankName.Text; unitInfo.BankAccount = tbBankAccount.Text; unitInfo.Certificate = tbCertificate.Text; if (!string.IsNullOrEmpty(ddlTradeSort.SelectedValue) && CY.Utility.Common.StringHelper.IsGuid(ddlTradeSort.SelectedValue.Trim())) { unitInfo.TradeSortID = new Guid(ddlTradeSort.SelectedValue); } unitInfo.IsModification = Convert.ToInt32(ddlIsModification.SelectedValue); unitInfo.Rel_certificate = tbRel_certificate.Text; unitInfo.Operation = tbOperation.Text; unitInfo.Remark = tbRemark.Text; unitInfo.IsCooperantUnit = Convert.ToInt32(FetchViewState("unittype")); unitInfo.AuditingState = Convert.ToInt32(Request.Form.Get("rdIsCheck")); int instructmentCount = default(int); if (!string.IsNullOrEmpty(tbInstructmentCount.Text) && int.TryParse(tbInstructmentCount.Text, out instructmentCount)) { unitInfo.InstrumentCount = instructmentCount; } unitInfo.Save(); if (unitInfo.IsCooperantUnit != 1) { CY.CSTS.Core.Business.NewsModule newsmodule = new CY.CSTS.Core.Business.NewsModule(); newsmodule.AddPerson = u.Name; newsmodule.AddTime = DateTime.Now; newsmodule.Name = "新闻"; newsmodule.Center = 2; newsmodule.Site = unitInfo.Id; newsmodule.WBS = unitInfo.Id.ToString(); newsmodule.TypeID = 1; newsmodule.CheckStatus = 2; newsmodule.Index = 10; newsmodule.Save(); CY.CSTS.Core.Business.NewsModule noticemodule = new CY.CSTS.Core.Business.NewsModule(); noticemodule.AddPerson = u.Name; noticemodule.AddTime = DateTime.Now; noticemodule.Name = "通知"; noticemodule.Center = 2; noticemodule.Site = unitInfo.Id; noticemodule.WBS = unitInfo.Id.ToString(); noticemodule.TypeID = 1; noticemodule.CheckStatus = 2; noticemodule.Index = 9; noticemodule.Save(); } #endregion SaveFiles(unitInfo.Id); SaveImg(unitInfo.Id); IsSucess = true; } } catch (Exception ex) { throw ex; } finally { } if (IsSucess) { if (FetchViewState("unittype") == "1") { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "script", "<script type='text/javascript'>alert('添加成功!');window.location.href='AssistUnitList.aspx';</script>"); } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "script", "<script type='text/javascript'>alert('添加成功!');window.location.href='SubCenterTabs.aspx';</script>"); } } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "script", "<script type='text/javascript'>alert('添加失败!');window.location.href='SubCenterTabs.aspx';</script>"); } }
public static void ImportUnit() { ImportSqlServerUtility sql = new ImportSqlServerUtility(); RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string strsql = "Select distinct * from Unit"; string instersql = "insert into RUnit(old,new) values('{0}','{1}')"; DataSet ds = sql.ExecuteSqlDataSet(strsql); if (ds != null) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { CY.CSTS.Core.Business.UnitInfo unit = new CY.CSTS.Core.Business.UnitInfo(); unit.UnitName = ds.Tables[0].Rows[i][1].ToString();//1 unit.UnitType = TransferUnitType(ds.Tables[0].Rows[i][2].ToString());//2 unit.Alias = ds.Tables[0].Rows[i][3].ToString();//3 unit.ProvinceID = TransferProvinceId(ds.Tables[0].Rows[i][4].ToString());//4 unit.CityID = TransferCityId(ds.Tables[0].Rows[i][5].ToString());//5 unit.Address = ds.Tables[0].Rows[i][6].ToString();//6 unit.Postalcode = ds.Tables[0].Rows[i][7].ToString();//7 unit.Tel = ds.Tables[0].Rows[i][8].ToString(); unit.Fax = ds.Tables[0].Rows[i][9].ToString(); unit.Website = ds.Tables[0].Rows[i][10].ToString(); unit.Email = ds.Tables[0].Rows[i][11].ToString(); unit.Ownership = TransferOwnerShip(ds.Tables[0].Rows[i][12].ToString()); unit.DrtificialPerson = ds.Tables[0].Rows[i][13].ToString(); unit.DrtificialPersonDutyID = TransferDutyid(ds.Tables[0].Rows[i][14].ToString()); unit.DrtificialPersonTel = ds.Tables[0].Rows[i][15].ToString(); unit.LinkDepartdement = ds.Tables[0].Rows[i][16].ToString(); unit.Linkman = ds.Tables[0].Rows[i][17].ToString(); unit.LinkmanDutyID = TransferDutyid(ds.Tables[0].Rows[i][18].ToString()); unit.LinkmanTel = ds.Tables[0].Rows[i][19].ToString(); unit.ChargeDepartMent = ds.Tables[0].Rows[i][20].ToString(); unit.BankAccountName = ds.Tables[0].Rows[i][21].ToString(); unit.BankName = ds.Tables[0].Rows[i][22].ToString(); unit.BankAccount = ds.Tables[0].Rows[i][23].ToString(); unit.Certificate = ds.Tables[0].Rows[i][24].ToString(); unit.Rel_certificate = ds.Tables[0].Rows[i][25].ToString(); unit.WorkCode = ds.Tables[0].Rows[i][26].ToString(); unit.Synopsis = ds.Tables[0].Rows[i][27].ToString(); unit.InstrumentSection = ds.Tables[0].Rows[i][28].ToString(); unit.VindicatorCount = int.Parse(!string.IsNullOrEmpty(ds.Tables[0].Rows[i][29].ToString()) ? ds.Tables[0].Rows[i][29].ToString() : "0"); //�����ϵ���п�Ժ��01����������02������������03���ط���10�� unit.Subjection = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][30].ToString()) ? int.Parse(ds.Tables[0].Rows[i][30].ToString()) : 0; unit.TradeSortID = TransferTradeId(ds.Tables[0].Rows[i][31].ToString()); unit.IsModification = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][32].ToString()) && bool.Parse(ds.Tables[0].Rows[i][32].ToString()) ? 1 : 2; unit.IsCooperantUnit = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][33].ToString()) && bool.Parse(ds.Tables[0].Rows[i][33].ToString()) ? 1 : 2; unit.Operation = ds.Tables[0].Rows[i][34].ToString(); unit.AuditingState = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][35].ToString()) ? int.Parse(ds.Tables[0].Rows[i][35].ToString()) : default(int); unit.Assessor = ds.Tables[0].Rows[i][36].ToString(); unit.AuditingDate = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][37].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][37].ToString()) : DateTime.MinValue; unit.Remark = ds.Tables[0].Rows[i][38].ToString(); unit.CreatDate = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][39].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][39].ToString()) : DateTime.MinValue; unit.UpdateDate = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][40].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][40].ToString()) : DateTime.MinValue; unit.Save(); rsql.ExecuteSql(string.Format(instersql, ds.Tables[0].Rows[i][0].ToString(), unit.Id)); } } }
protected void Initial() { try { UnitTypes = CY.CSTS.Core.Business.UnitType.GetAllUnitType() as List<CY.CSTS.Core.Business.UnitType>; SubCenters = CY.CSTS.Core.Business.UnitInfo.SelectUnitinfoBySearchConditionPageInfo(ujson, pagingInfo); AssistUnits = CY.CSTS.Core.Business.UnitInfo.SelectUnitinfoBySearchConditionPageInfo(ajson, pagingInfo); if (SubCenters != null) { CurrentUnits = SubCenters.FirstOrDefault(); } else { if (AssistUnits != null) { CurrentUnits = AssistUnits.FirstOrDefault(); } } } catch (Exception ex) { throw ex; } finally { } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UnitID"] != null) { SubCenterID = Session["UnitID"].ToString(); unitInfo = CY.CSTS.Core.Business.UnitInfo.GetUnitInfo(new Guid(SubCenterID)); if (!Page.IsPostBack) { gotguid = new Guid(SubCenterID); if (gotguid != Guid.Empty) { HeaderDataBind(gotguid); ddlUnitTypeDataBind(); ddlDutiesDataBind(); ddlProvinceDataBind(); ddlTradeSortDataBind(); FieldDataBind(); AnnexDataBind(); } } } }
/// <summary> /// 绑顶部资料 /// </summary> protected void HeaderDataBind(Guid guid) { try { unitInfo = CY.CSTS.Core.Business.UnitInfo.GetUnitInfo(guid); if (unitInfo != null) { ltUnitName.Text = unitInfo.UnitName; } } catch (Exception ex) { throw ex; } }