private void btnDel_Click(object sender, ImageClickEventArgs e) { string PKID; int selectedIndex = -1; foreach (DataGridItem item in this.dgCWPerInfo.Items) { if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { if (((System.Web.UI.WebControls.RadioButton)item.Cells[0].Controls[1]).Checked) { selectedIndex = item.ItemIndex; break; } } } if (selectedIndex != -1) { PKID = this.dgCWPerInfo.Items[selectedIndex].Cells[1].Text; Wicresoft.Session.Session session = new Wicresoft.Session.Session(); BusinessMapping.CWPerInfo bo = new BusinessMapping.CWPerInfo(); bo.SessionInstance = session; BusinessFilter filter = new BusinessFilter("CWPerInfo"); filter.AddFilterItem("PKID", PKID.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND); bo.AddFilter(filter); bo.Load(); if (bo.HaveRecord) { bo.ModifyUser.Value = GlobalFacade.SystemContext.GetContext().UserID; bo.ModifyTime.Value = DateTime.Now; bo.IsValid.Value = false; bo.Update(); // Reload Data ucCustomPaging.LoadData(ucCustomPaging.CurrentPage); } } }
public void Update() { BusinessMapping.CWPerInfo bo = new BusinessMapping.CWPerInfo(); bo.SessionInstance = new Wicresoft.Session.Session(); BusinessFilter filter = new BusinessFilter("CWPerInfo"); filter.AddFilterItem("PKID", this.PKID.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND); bo.AddFilter(filter); bo.Load(); if (bo.HaveRecord) { int userID = GlobalFacade.SystemContext.GetContext().UserID; if (this.gpCWInfo.SelectedValue != string.Empty && this.gpCWInfo.SelectedValue != "0") { bo.FK_CWID.Value = Convert.ToInt32(this.gpCWInfo.SelectedValue); } else { bo.FK_CWID.Value = 0; } bo.IDCardNo.Value = this.txtIDCardNo.Text.Trim(); bo.Name.Value = this.txtName.Text.Trim(); if (this.ddlSex.SelectedValue != string.Empty && this.ddlSex.SelectedValue != "0") { bo.Sex.Value = Convert.ToInt32(this.ddlSex.SelectedValue); } else { bo.Sex.Value = 0; } if (this.ddlNation.SelectedValue != string.Empty && this.ddlNation.SelectedValue != "0") { bo.Nation.Value = Convert.ToInt32(this.ddlNation.SelectedValue); } else { bo.Nation.Value = 0; } if (this.ddlPolitics.SelectedValue != string.Empty && this.ddlPolitics.SelectedValue != "0") { bo.Politics.Value = Convert.ToInt32(this.ddlPolitics.SelectedValue); } else { bo.Politics.Value = 0; } if (this.ddlIsHolder.SelectedValue != string.Empty && this.ddlIsHolder.SelectedValue != "0") { bo.IsHolder.Value = Convert.ToInt32(this.ddlIsHolder.SelectedValue); } else { bo.IsHolder.Value = 0; } bo.HolderName.Value = this.txtHolderName.Text.Trim(); bo.HolderIDCardNo.Value = this.txtHolderIDCardNo.Text.Trim(); if (this.ddlHolderPorp.SelectedValue != "" && this.ddlHolderPorp.SelectedValue != "0") { bo.HolderPorp.Value = Convert.ToInt32(this.ddlHolderPorp.SelectedValue); } else { bo.HolderPorp.Value = 0; } bo.HolderAddress.Value = this.txtHolderAddress.Text.Trim(); bo.LiveAddress.Value = this.txtLiveAddress.Text.Trim(); bo.LinkPhone.Value = this.txtLinkPhone.Text.Trim(); bo.WorkUnit.Value = this.txtWorkUnit.Text.Trim(); if (this.ddlMarrigeStatus.SelectedValue != string.Empty && this.ddlMarrigeStatus.SelectedValue != "0") { bo.MarrigeStatus.Value = Convert.ToInt32(this.ddlMarrigeStatus.SelectedValue); } else { bo.MarrigeStatus.Value = 0; } if (this.txtMarrigeDate.Text != "") { bo.MarrigeDate.Value = Convert.ToDateTime(this.txtMarrigeDate.Text); } bo.MarrigeNo.Value = this.txtMarrigeNo.Text.Trim(); bo.MarrigeName.Value = this.txtMarrigeName.Text.Trim(); bo.MarrigeIDCardNo.Value = this.txtMarrigeIDCardNo.Text.Trim(); if (this.ddlChildren.SelectedValue != string.Empty && this.ddlChildren.SelectedValue != "0") { bo.Children.Value = Convert.ToInt32(this.ddlChildren.SelectedValue); } else { bo.Children.Value = 0; } if (this.ddlIsSingle.SelectedValue != string.Empty && this.ddlIsSingle.SelectedValue != "0") { bo.IsSingle.Value = Convert.ToInt32(this.ddlIsSingle.SelectedValue); } else { bo.IsSingle.Value = 0; } bo.ChildName1.Value = this.txtChildName1.Text.Trim(); bo.ChildIDCardNo1.Value = this.txtChildIDCardNo1.Text.Trim(); bo.ChildAddress1.Value = this.txtChildAddress1.Text.Trim(); bo.BirthNo1.Value = this.txtBirthNo1.Text.Trim(); if (this.txtBirthDate1.Text != "") { bo.BirthDate1.Value = Convert.ToDateTime(this.txtBirthDate1.Text); } bo.AdoptNo1.Value = this.txtAdoptNo1.Text.Trim(); bo.ChildName2.Value = this.txtChildName2.Text.Trim(); bo.ChildIDCardNo2.Value = this.txtChildIDCardNo2.Text.Trim(); bo.ChildAddress2.Value = this.txtChildAddress2.Text.Trim(); bo.BirthNo2.Value = this.txtBirthNo2.Text.Trim(); if (this.txtBirthDate2.Text != "") { bo.BirthDate2.Value = Convert.ToDateTime(this.txtBirthDate2.Text); } bo.AdoptNo2.Value = this.txtAdoptNo2.Text.Trim(); bo.ChildName3.Value = this.txtChildName3.Text.Trim(); bo.ChildIDCardNo3.Value = this.txtChildIDCardNo3.Text.Trim(); bo.ChildAddress3.Value = this.txtChildAddress3.Text.Trim(); bo.BirthNo3.Value = this.txtBirthNo3.Text.Trim(); if (this.txtBirthDate3.Text != "") { bo.BirthDate3.Value = Convert.ToDateTime(this.txtBirthDate3.Text); } bo.AdoptNo3.Value = this.txtAdoptNo3.Text.Trim(); bo.ModifyUser.Value = userID; bo.ModifyTime.Value = DateTime.Now; bo.Memo.Value = this.txtMemo.Text.Trim(); bo.Update(); string strSql = string.Empty; if (this.txtMarrigeDate.Text == "" && bo.MarrigeDate.Value != DateTime.MinValue) { strSql += string.Format("UPDATE CWPerInfo SET MarrigeDate = NULL WHERE PKID = {0}; ", this.PKID); } if (this.txtBirthDate1.Text == "" && bo.BirthDate1.Value != DateTime.MinValue) { strSql += string.Format("UPDATE CWPerInfo SET BirthDate1 = NULL WHERE PKID = {0}; ", this.PKID); } if (this.txtBirthDate2.Text == "" && bo.BirthDate2.Value != DateTime.MinValue) { strSql += string.Format("UPDATE CWPerInfo SET BirthDate2 = NULL WHERE PKID = {0}; ", this.PKID); } if (this.txtBirthDate3.Text == "" && bo.BirthDate3.Value != DateTime.MinValue) { strSql += string.Format("UPDATE CWPerInfo SET BirthDate3 = NULL WHERE PKID = {0}; ", this.PKID); } if (strSql != string.Empty) { Wicresoft.Session.Session session = new Wicresoft.Session.Session(); session.SqlHelper.ExecuteNonQuery(strSql, CommandType.Text); } } }
public void LoadBaseInfo(int pkid) { BusinessMapping.CWPerInfo bo = new BusinessMapping.CWPerInfo(); bo.SessionInstance = new Wicresoft.Session.Session(); BusinessFilter filter = new BusinessFilter("CWPerInfo"); filter.AddFilterItem("PKID", pkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND); bo.AddFilter(filter); bo.Load(); if (bo.HaveRecord) { if (bo.FK_CWID.Value > 0) { this.gpCWInfo.SelectedValue = bo.FK_CWID.Value.ToString(); } this.txtIDCardNo.Text = bo.IDCardNo.Value; this.txtName.Text = bo.Name.Value; if (bo.Sex.Value > 0) { this.ddlSex.SelectedValue = bo.Sex.Value.ToString(); } if (bo.Nation.Value > 0) { this.ddlNation.SelectedValue = bo.Nation.Value.ToString(); } if (bo.Politics.Value > 0) { this.ddlPolitics.SelectedValue = bo.Politics.Value.ToString(); } if (bo.IsHolder.Value > 0) { this.ddlIsHolder.SelectedValue = bo.IsHolder.Value.ToString(); } this.txtHolderName.Text = bo.HolderName.Value; this.txtHolderIDCardNo.Text = bo.HolderIDCardNo.Value; if (bo.HolderPorp.Value > 0) { this.ddlHolderPorp.Text = bo.HolderPorp.Value.ToString(); } this.txtHolderAddress.Text = bo.HolderAddress.Value; this.txtLiveAddress.Text = bo.LiveAddress.Value; this.txtLinkPhone.Text = bo.LinkPhone.Value; this.txtWorkUnit.Text = bo.WorkUnit.Value; if (bo.MarrigeStatus.Value > 0) { this.ddlMarrigeStatus.SelectedValue = bo.MarrigeStatus.Value.ToString(); } if (bo.MarrigeDate.Value != DateTime.MinValue) { this.txtMarrigeDate.Text = bo.MarrigeDate.Value.ToString("yyyy-MM-dd"); } this.txtMarrigeNo.Text = bo.MarrigeNo.Value; this.txtMarrigeName.Text = bo.MarrigeName.Value; this.txtMarrigeIDCardNo.Text = bo.MarrigeIDCardNo.Value; if (bo.Children.Value > 0) { this.ddlChildren.SelectedValue = bo.Children.Value.ToString(); } if (bo.IsSingle.Value > 0) { this.ddlIsSingle.SelectedValue = bo.IsSingle.Value.ToString(); } this.txtChildName1.Text = bo.ChildName1.Value; this.txtChildIDCardNo1.Text = bo.ChildIDCardNo1.Value; this.txtChildAddress1.Text = bo.ChildAddress1.Value; this.txtBirthNo1.Text = bo.BirthNo1.Value; if (bo.BirthDate1.Value != DateTime.MinValue) { this.txtBirthDate1.Text = bo.BirthDate1.Value.ToString("yyyy-MM-dd"); } this.txtAdoptNo1.Text = bo.AdoptNo1.Value; this.txtChildName2.Text = bo.ChildName2.Value; this.txtChildIDCardNo2.Text = bo.ChildIDCardNo2.Value; this.txtChildAddress2.Text = bo.ChildAddress2.Value; this.txtBirthNo2.Text = bo.BirthNo2.Value; if (bo.BirthDate2.Value != DateTime.MinValue) { this.txtBirthDate2.Text = bo.BirthDate2.Value.ToString("yyyy-MM-dd"); } this.txtAdoptNo2.Text = bo.AdoptNo2.Value; this.txtChildName3.Text = bo.ChildName3.Value; this.txtChildIDCardNo3.Text = bo.ChildIDCardNo3.Value; this.txtChildAddress3.Text = bo.ChildAddress3.Value; this.txtBirthNo3.Text = bo.BirthNo3.Value; if (bo.BirthDate3.Value != DateTime.MinValue) { this.txtBirthDate3.Text = bo.BirthDate3.Value.ToString("yyyy-MM-dd"); } this.txtAdoptNo3.Text = bo.AdoptNo3.Value; this.txtMemo.Text = bo.Memo.Value; } }
public void Save() { int userID = GlobalFacade.SystemContext.GetContext().UserID; BusinessMapping.CWPerInfo bo = new BusinessMapping.CWPerInfo(); bo.SessionInstance = new Wicresoft.Session.Session(); if (this.gpCWInfo.SelectedValue != string.Empty && this.gpCWInfo.SelectedValue != "0") { bo.FK_CWID.Value = Convert.ToInt32(this.gpCWInfo.SelectedValue); } bo.IDCardNo.Value = this.txtIDCardNo.Text.Trim(); bo.Name.Value = this.txtName.Text.Trim(); if (this.ddlSex.SelectedValue != string.Empty && this.ddlSex.SelectedValue != "0") { bo.Sex.Value = Convert.ToInt32(this.ddlSex.SelectedValue); } if (this.ddlNation.SelectedValue != string.Empty && this.ddlNation.SelectedValue != "0") { bo.Nation.Value = Convert.ToInt32(this.ddlNation.SelectedValue); } if (this.ddlPolitics.SelectedValue != string.Empty && this.ddlPolitics.SelectedValue != "0") { bo.Politics.Value = Convert.ToInt32(this.ddlPolitics.SelectedValue); } if (this.ddlIsHolder.SelectedValue != string.Empty && this.ddlIsHolder.SelectedValue != "0") { bo.IsHolder.Value = Convert.ToInt32(this.ddlIsHolder.SelectedValue); } bo.HolderName.Value = this.txtHolderName.Text.Trim(); bo.HolderIDCardNo.Value = this.txtHolderIDCardNo.Text.Trim(); if (this.ddlHolderPorp.SelectedValue != "" && this.ddlHolderPorp.SelectedValue != "0") { bo.HolderPorp.Value = Convert.ToInt32(this.ddlHolderPorp.SelectedValue); } bo.HolderAddress.Value = this.txtHolderAddress.Text.Trim(); bo.LiveAddress.Value = this.txtLiveAddress.Text.Trim(); bo.LinkPhone.Value = this.txtLinkPhone.Text.Trim(); bo.WorkUnit.Value = this.txtWorkUnit.Text.Trim(); if (this.ddlMarrigeStatus.SelectedValue != string.Empty && this.ddlMarrigeStatus.SelectedValue != "0") { bo.MarrigeStatus.Value = Convert.ToInt32(this.ddlMarrigeStatus.SelectedValue); } if (this.txtMarrigeDate.Text != "") { bo.MarrigeDate.Value = Convert.ToDateTime(this.txtMarrigeDate.Text); } bo.MarrigeNo.Value = this.txtMarrigeNo.Text.Trim(); bo.MarrigeName.Value = this.txtMarrigeName.Text.Trim(); bo.MarrigeIDCardNo.Value = this.txtMarrigeIDCardNo.Text.Trim(); if (this.ddlChildren.SelectedValue != string.Empty && this.ddlChildren.SelectedValue != "0") { bo.Children.Value = Convert.ToInt32(this.ddlChildren.SelectedValue); } if (this.ddlIsSingle.SelectedValue != string.Empty && this.ddlIsSingle.SelectedValue != "0") { bo.IsSingle.Value = Convert.ToInt32(this.ddlIsSingle.SelectedValue); } bo.ChildName1.Value = this.txtChildName1.Text.Trim(); bo.ChildIDCardNo1.Value = this.txtChildIDCardNo1.Text.Trim(); bo.ChildAddress1.Value = this.txtChildAddress1.Text.Trim(); bo.BirthNo1.Value = this.txtBirthNo1.Text.Trim(); if (this.txtBirthDate1.Text != "") { bo.BirthDate1.Value = Convert.ToDateTime(this.txtBirthDate1.Text); } bo.AdoptNo1.Value = this.txtAdoptNo1.Text.Trim(); bo.ChildName2.Value = this.txtChildName2.Text.Trim(); bo.ChildIDCardNo2.Value = this.txtChildIDCardNo2.Text.Trim(); bo.ChildAddress2.Value = this.txtChildAddress2.Text.Trim(); bo.BirthNo2.Value = this.txtBirthNo2.Text.Trim(); if (this.txtBirthDate2.Text != "") { bo.BirthDate2.Value = Convert.ToDateTime(this.txtBirthDate2.Text); } bo.AdoptNo2.Value = this.txtAdoptNo2.Text.Trim(); bo.ChildName3.Value = this.txtChildName3.Text.Trim(); bo.ChildIDCardNo3.Value = this.txtChildIDCardNo3.Text.Trim(); bo.ChildAddress3.Value = this.txtChildAddress3.Text.Trim(); bo.BirthNo3.Value = this.txtBirthNo3.Text.Trim(); if (this.txtBirthDate3.Text != "") { bo.BirthDate3.Value = Convert.ToDateTime(this.txtBirthDate3.Text); } bo.AdoptNo3.Value = this.txtAdoptNo3.Text.Trim(); bo.CreateUser.Value = userID; bo.CreateTime.Value = DateTime.Now; bo.Memo.Value = this.txtMemo.Text.Trim(); bo.Insert(); }