private void BindData(string srid) { //得到对象实体 AchievementModel = AchievementBll.GetModel(srid); UserModel = UserBll.GetModel(AchievementModel.FK_UserID); //绑定数据到Label lblUserName.Text = UserModel.UserName; lblUserUnit.Text = UserModel.Unit; lblSex.Text = UserModel.Sex; lblZhiCheng.Text = UserModel.ZhiCheng; lblBigSort.Text = AchievementModel.BigSort; lblSchoolSign.Text = AchievementModel.SchoolSign; lblRank.Text = (AchievementModel.Rank).ToString(); lblPopulation.Text = (AchievementModel.Population).ToString(); lblAllAuthor.Text = AchievementModel.AllAuthor; lblRemark.Text = AchievementModel.Remark; lblJiBie.Text = (AchievementModel.LevelFactor).ToString() + AchievementModel.JiBie; lblPerScore.Text = (AchievementModel.PerScore).ToString(); string state = (AchievementModel.AuditState).ToString(); lblAuditState.Text = StateInfo.GetAuditState(state); lblReason.Text = AchievementModel.Extra1; if (state == "2" || state == "4" || state == "6") { PanelReasonVisible.Visible = true; } lblSRID.Text = AchievementModel.PK_AID; lblTitle.Text = AchievementModel.Title; lblTime.Text = string.Format("{0:yyyy-MM-dd}", AchievementModel.PublishTime); lblType.Text = AchievementModel.Type; lblUnit.Text = AchievementModel.Unit; lblNumber.Text = AchievementModel.Number; //if (state == "1" || state == "3" || state == "5" || state == "7") //{ // Button1.Enabled = false; // Button2.Enabled = false; //} //if (state == "3" || state == "5" || state == "7") //{ // Button3.Enabled = false; // Button4.Enabled = false; //} //if (state == "5" || state == "7") //{ // Button5.Enabled = false; // Button6.Enabled = false; //} //if (state == "7") //{ // Button7.Enabled = false; // Button8.Enabled = false; //} }
/// <summary> /// 获得数据列表 /// </summary> public List<ZQUSR.Model.sr_User> DataTableToList(DataTable dt) { List<ZQUSR.Model.sr_User> modelList = new List<ZQUSR.Model.sr_User>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ZQUSR.Model.sr_User model; for (int n = 0; n < rowsCount; n++) { model = new ZQUSR.Model.sr_User(); model.PK_UserID = dt.Rows[n]["PK_UserID"].ToString(); model.UserName = dt.Rows[n]["UserName"].ToString(); model.Password = dt.Rows[n]["Password"].ToString(); model.Sex = dt.Rows[n]["Sex"].ToString(); model.Unit = dt.Rows[n]["Unit"].ToString(); model.Education = dt.Rows[n]["Education"].ToString(); model.ZhiCheng = dt.Rows[n]["ZhiCheng"].ToString(); model.Telephone = dt.Rows[n]["Telephone"].ToString(); if (dt.Rows[n]["InOffice"].ToString() != "") { model.InOffice = int.Parse(dt.Rows[n]["InOffice"].ToString()); } model.Email = dt.Rows[n]["Email"].ToString(); if (dt.Rows[n]["Logins"].ToString() != "") { model.Logins = int.Parse(dt.Rows[n]["Logins"].ToString()); } if (dt.Rows[n]["LastLogin"].ToString() != "") { model.LastLogin = DateTime.Parse(dt.Rows[n]["LastLogin"].ToString()); } if (dt.Rows[n]["Status"].ToString() != "") { model.Status = int.Parse(dt.Rows[n]["Status"].ToString()); } model.Extra1 = dt.Rows[n]["Extra1"].ToString(); model.Extra2 = dt.Rows[n]["Extra2"].ToString(); model.Extra3 = dt.Rows[n]["Extra3"].ToString(); modelList.Add(model); } } return modelList; }
/// <summary> /// ��������б� /// </summary> public List<ZQUSR.Model.sr_User> DataTableToList(DataTable dt) { List<ZQUSR.Model.sr_User> modelList = new List<ZQUSR.Model.sr_User>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ZQUSR.Model.sr_User model; for (int n = 0; n < rowsCount; n++) { model = new ZQUSR.Model.sr_User(); model.PK_UserID = dt.Rows[n]["PK_UserID"].ToString(); model.UserName = dt.Rows[n]["UserName"].ToString(); model.Password = dt.Rows[n]["Password"].ToString(); model.Sex = dt.Rows[n]["Sex"].ToString(); model.Unit = dt.Rows[n]["Unit"].ToString(); model.Education = dt.Rows[n]["Education"].ToString(); model.ZhiCheng = dt.Rows[n]["ZhiCheng"].ToString(); model.Telephone = dt.Rows[n]["Telephone"].ToString(); if (dt.Rows[n]["InOffice"].ToString() != "") { model.InOffice = int.Parse(dt.Rows[n]["InOffice"].ToString()); } model.Email = dt.Rows[n]["Email"].ToString(); if (dt.Rows[n]["Logins"].ToString() != "") { model.Logins = int.Parse(dt.Rows[n]["Logins"].ToString()); } if (dt.Rows[n]["LastLogin"].ToString() != "") { model.LastLogin = DateTime.Parse(dt.Rows[n]["LastLogin"].ToString()); } if (dt.Rows[n]["Status"].ToString() != "") { model.Status = int.Parse(dt.Rows[n]["Status"].ToString()); } model.Extra1 = dt.Rows[n]["Extra1"].ToString(); model.Extra2 = dt.Rows[n]["Extra2"].ToString(); model.Extra3 = dt.Rows[n]["Extra3"].ToString(); modelList.Add(model); } } return modelList; }
/// <summary> /// 更新一条数据 /// </summary> public void Update(ZQUSR.Model.sr_User model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(ZQUSR.Model.sr_User model) { dal.Add(model); }