示例#1
0
        private void btnDel_Click(object sender, ImageClickEventArgs e)
        {
            string PKID;
            int    selectedIndex = -1;

            foreach (DataGridItem item in this.dgUser.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.dgUser.Items[selectedIndex].Cells[1].Text;
                Wicresoft.Session.Session session = new Wicresoft.Session.Session();
                BusinessMapping.User      bo      = new BusinessMapping.User();
                bo.SessionInstance = session;

                BusinessFilter filter = new BusinessFilter("User");
                filter.AddFilterItem("PKID", PKID.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
                bo.AddFilter(filter);
                bo.Load();

                if (bo.IsReserved.Value)
                {
                    GlobalFacade.Utils.ShowMessage(Enums.Constants.RecordReserved);
                }
                else
                {
                    bo.ModifyUser.Value = this.MyContext.UserID;
                    bo.ModifyTime.Value = DateTime.Now;
                    bo.IsValid.Value    = false;
                    bo.Update();

                    //BusinessRule.SystemManage.OperationLog rule = new BusinessRule.SystemManage.OperationLog();
                    //rule.WriteOperationLog("用户信息管理", "删除用户信息");

                    // Reload Data
                    ucCustomPaging.LoadData(ucCustomPaging.CurrentPage);
                }
            }
        }
示例#2
0
        /// <summary>
        /// 导出独生子女统计列表
        /// </summary>
        /// <param name="pageSize">页大小(一次取出的记录数)</param>
        /// <param name="pageIndex">页码(1开始)</param>
        /// <param name="subfilter">筛选条件对象</param>
        /// <returns>结果集</returns>
        public DataTable GetCWOneChildListForExport(int pageSize, int pageIndex, BusinessFilter subfilter)
        {
            Wicresoft.Session.Session session = new Wicresoft.Session.Session();
            BusinessObjectCollection  boc     = new BusinessObjectCollection("CWOneChild");

            boc.SessionInstance = session;
            BusinessFilter filter = new BusinessFilter("CWOneChild");

            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            if (subfilter != null)
            {
                filter.AddFilter(subfilter, AndOr.AND);
            }
            boc.AddFilter(filter);
            return(boc.GetDataTable());
        }
示例#3
0
        public void FillMenus(DataTable dt)
        {
            Wicresoft.Session.Session session = new Wicresoft.Session.Session();
            M2G.Web.UI.TreeViewNode   node;
            foreach (DataRow dr in dt.Rows)
            {
                node      = new M2G.Web.UI.TreeViewNode();
                node.Text = dr["ChineseName"].ToString();
                if (dr["URL"].ToString() != string.Empty && Convert.ToBoolean(dr["IsLeaf"].ToString()))
                {
                    node.Target      = "main";
                    node.NavigateUrl = dr["URL"].ToString();
                }

                DataTable tempTable = GetMenusForParentID(dr["PKID"].ToString());
                FillNode(node, tempTable);
                TreeView1.Nodes.Add(node);
            }
        }
示例#4
0
        /// <summary>
        /// 更新用户主档信息
        /// </summary>
        /// <param name="session"></param>
        /// <param name="userid"></param>
        private void UpdateUserInfo(Wicresoft.Session.Session session, int userid)
        {
            BusinessMapping.User bo = new BusinessMapping.User();
            bo.SessionInstance = session;

            BusinessFilter filter = new BusinessFilter("User");

            filter.AddFilterItem("PKID", userid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);

            bo.AddFilter(filter);
            bo.Load();

            if (bo.HaveRecord)
            {
                bo.Alias.Value       = this.tbxAlias.Text.Trim();
                bo.ChineseName.Value = this.tbxChineseName.Text.Trim();
                bo.EnglishName.Value = this.tbxEnglishName.Text.Trim();
                bo.Gender.Value      = Convert.ToBoolean(this.rbtnGender.SelectedValue);
                bo.IsActive.Value    = this.cbxIsActive.Checked;

                if (this.gpRole.SelectedValue != string.Empty && this.gpRole.SelectedValue != "0")
                {
                    bo.FK_Role.Value = Convert.ToInt32(this.gpRole.SelectedValue);
                }

                bo.Title.Value   = this.tbxTitle.Text.Trim();
                bo.Mobile.Value  = this.tbxMobile.Text.Trim();
                bo.Email.Value   = this.tbxEmail.Text.Trim();
                bo.Address.Value = this.tbxAddress.Text.Trim();

                if (this.tbxBirthday.Text.Trim() != string.Empty)
                {
                    bo.Birthday.Value = Convert.ToDateTime(this.tbxBirthday.Text.Trim());
                }

                bo.Memo.Value = this.tbxMemo.Text.Trim();

                bo.ModifyTime.Value = DateTime.Now;
                bo.ModifyUser.Value = GlobalFacade.SystemContext.GetContext().UserID;
                bo.Update();
            }
        }
示例#5
0
        /// <summary>
        /// 获取独生子女统计列表
        /// </summary>
        /// <param name="totalCount">记录总数</param>
        /// <param name="pageSize">页大小(一次取出的记录数)</param>
        /// <param name="pageIndex">页码(1开始)</param>
        /// <param name="obType">排续类型</param>
        /// <param name="subfilter">筛选条件对象</param>
        /// <returns>结果集</returns>
        public DataTable GetCWOneChildList(out int totalCount, int pageSize, int pageIndex,
                                           Common.OrderByType obType, BusinessFilter subfilter)
        {
            Wicresoft.Session.Session session = new Wicresoft.Session.Session();
            BusinessObjectCollection  boc     = new BusinessObjectCollection("CWOneChild");

            boc.SessionInstance = session;
            BusinessFilter filter = new BusinessFilter("CWOneChild");

            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            if (subfilter != null)
            {
                filter.AddFilter(subfilter, AndOr.AND);
            }
            boc.AddFilter(filter);
            DataSet ds = boc.GetPagedRecords(pageIndex, pageSize, "PKID", (obType == Common.OrderByType.DESC)?true:false);

            totalCount = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
            return(ds.Tables[1]);
        }
示例#6
0
        private void btnDel_Click(object sender, ImageClickEventArgs e)
        {
            string PKID;
            int    selectedIndex = -1;

            foreach (DataGridItem item in this.dgCWOneChild.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.dgCWOneChild.Items[selectedIndex].Cells[1].Text;
                Wicresoft.Session.Session  session = new Wicresoft.Session.Session();
                BusinessMapping.CWOneChild bo      = new BusinessMapping.CWOneChild();
                bo.SessionInstance = session;

                BusinessFilter filter = new BusinessFilter("CWOneChild");
                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);
                }
            }
        }
示例#7
0
        /* 根据名称获取用户组ID */
        public int GetRoleID(string rolename)
        {
            int roleid = -1;

            Wicresoft.Session.Session session = new Wicresoft.Session.Session();
            BusinessMapping.Role      bo      = new BusinessMapping.Role();
            bo.SessionInstance = session;

            BusinessFilter filter = new BusinessFilter("Role");

            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("RoleName", rolename, Operation.Equal, FilterType.StringType, AndOr.AND);
            bo.AddFilter(filter);
            bo.Load();

            if (bo.HaveRecord)
            {
                roleid = bo.PKID.Value;
            }

            return(roleid);
        }
示例#8
0
        public string GetRoleName(string roleID)
        {
            string rolename = string.Empty;

            Wicresoft.Session.Session session = new Wicresoft.Session.Session();
            BusinessMapping.Role      bo      = new BusinessMapping.Role();
            bo.SessionInstance = session;

            BusinessFilter filter = new BusinessFilter("Role");

            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("PKID", roleID, Operation.Equal, FilterType.StringType, AndOr.AND);
            bo.AddFilter(filter);
            bo.Load();

            if (bo.HaveRecord)
            {
                rolename = bo.RoleName.Value;
            }

            return(rolename);
        }
示例#9
0
        /// <summary>
        /// 更新用户信息(主入口)
        /// </summary>
        public void Update()
        {
            Wicresoft.Session.Session session = new Wicresoft.Session.Session();

            try
            {
                session.BeginTransaction();

                // 更新用户主档信息
                UpdateUserInfo(session, this.PKID);

                session.Commit();

                // Write Log
                //BusinessRule.SystemManage.OperationLog rule = new BusinessRule.SystemManage.OperationLog();
                //rule.WriteOperationLog("用户信息管理", "编辑用户信息");
            }
            catch (System.Data.SqlClient.SqlException)
            {
                session.Rollback();
            }
        }
示例#10
0
        /// <summary>
        /// 创建新用户(主入口)
        /// </summary>
        public void Save()
        {
            Wicresoft.Session.Session session = new Wicresoft.Session.Session();

            try
            {
                session.BeginTransaction();

                // 插入主档信息
                int userid = InsertUserInfo(session);

                session.Commit();

                // Write Log
                //BusinessRule.SystemManage.OperationLog rule = new BusinessRule.SystemManage.OperationLog();
                //rule.WriteOperationLog("用户信息管理", "新增用户信息");
            }
            catch (System.Data.SqlClient.SqlException)
            {
                session.Rollback();
            }
        }
示例#11
0
        /// <summary>
        /// 插入用户信息
        /// </summary>
        /// <param name="session"></param>
        /// <returns>返回用户对象的PKID</returns>
        private int InsertUserInfo(Wicresoft.Session.Session session)
        {
            // 插入用户信息
            BusinessMapping.User bo = new BusinessMapping.User();
            bo.SessionInstance = session;

            bo.Alias.Value       = this.tbxAlias.Text.Trim();
            bo.ChineseName.Value = this.tbxChineseName.Text.Trim();
            bo.EnglishName.Value = this.tbxEnglishName.Text.Trim();
            bo.Gender.Value      = Convert.ToBoolean(this.rbtnGender.SelectedValue);
            bo.Password.Value    = GlobalFacade.EncryptionManager.EncrytPassword(System.Configuration.ConfigurationManager.AppSettings["DefaultPassword"]);
            bo.IsActive.Value    = this.cbxIsActive.Checked;

            if (this.gpRole.SelectedValue != string.Empty && this.gpRole.SelectedValue != "0")
            {
                bo.FK_Role.Value = Convert.ToInt32(this.gpRole.SelectedValue);
            }
            bo.Title.Value   = this.tbxTitle.Text.Trim();
            bo.Mobile.Value  = this.tbxMobile.Text.Trim();
            bo.Email.Value   = this.tbxEmail.Text.Trim();
            bo.Address.Value = this.tbxAddress.Text.Trim();

            if (this.tbxBirthday.Text.Trim() != string.Empty)
            {
                bo.Birthday.Value = Convert.ToDateTime(this.tbxBirthday.Text.Trim());
            }

            bo.Memo.Value = this.tbxMemo.Text.Trim();

            bo.CreateTime.Value = DateTime.Now;
            bo.ModifyTime.Value = DateTime.Now;
            bo.CreateUser.Value = GlobalFacade.SystemContext.GetContext().UserID;
            bo.ModifyUser.Value = GlobalFacade.SystemContext.GetContext().UserID;
            bo.Insert();

            return(bo.PKID.Value);
        }
示例#12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int parentMenuId = Convert.ToInt32(Request.QueryString["menuid"]);

            strSqlWhere = " PKID IN (SELECT  RoleMenu.FK_Menu FROM dbo.[User] "
                          + "LEFT JOIN RoleMenu ON RoleMenu.FK_Role = dbo.[User].FK_Role WHERE dbo.[User].PKID = " + GlobalFacade.SystemContext.GetContext().UserID.ToString() + ")";

            dtMenuItems = new Wicresoft.Session.Session().SqlHelper.ExcuteDataTable(dtMenuItems,
                                                                                    "SELECT * FROM Menu WHERE IsLeaf=0 AND IsValid = 1 AND Parent = 0 AND " + strSqlWhere
                                                                                    + " ORDER BY [Parent],[DisplayOrder]", CommandType.Text);

            string     url = "Menu.aspx?Parent=0&Title=主菜单";
            HtmlAnchor a   = new HtmlAnchor();

            a.InnerHtml = "主菜单";
            a.HRef      = "javascript:void(0)";
            a.Style.Add("text-decoration", "none");
            a.Style.Add("padding-left", "10px");
            a.Style.Add("padding-right", "10px");
            a.Attributes.Add("onclick", string.Format("MenuItemClick(this,\"{0}\")", url));

            this.divContainer.Controls.Add(a);

            foreach (DataRow dr in dtMenuItems.Rows)
            {
                url         = "Menu.aspx?Parent=" + dr["PKID"].ToString() + "&Title=" + dr["Chinesename"].ToString();
                a           = new HtmlAnchor();
                a.InnerHtml = dr["Chinesename"].ToString();
                a.HRef      = "javascript:void(0)";
                a.Style.Add("text-decoration", "none");
                a.Style.Add("padding-left", "6px");
                a.Style.Add("padding-right", "6px");
                a.Attributes.Add("onclick", string.Format("MenuItemClick(this,\"{0}\")", url));

                this.divContainer.Controls.Add(a);
            }
        }
示例#13
0
        /// <summary>
        /// 获取行政区列表
        /// </summary>
        /// <param name="totalCount">记录总数</param>
        /// <param name="pageSize">页大小(一次取出的记录数)</param>
        /// <param name="pageIndex">页码(1开始)</param>
        /// <param name="obType">排续类型</param>
        /// <param name="subfilter">筛选条件对象</param>
        /// <returns>结果集</returns>
        public DataTable GetDistrictList(out int totalCount, int pageSize, int pageIndex,
                                         Common.OrderByType obType, BusinessFilter subfilter)
        {
            BusinessRule.BaseData.Region rule = new Region();

            Wicresoft.Session.Session session = new Wicresoft.Session.Session();
            BusinessObjectCollection  boc     = new BusinessObjectCollection("District");

            boc.SessionInstance = session;
            BusinessFilter filter = new BusinessFilter("District");

            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddCustomerFilter("District.FK_Dictionary IN (" + rule.GetAuthorizedCitiesPKID(GlobalFacade.SystemContext.GetContext().UserID) + ")", AndOr.AND);

            if (subfilter != null)
            {
                filter.AddFilter(subfilter, AndOr.AND);
            }
            boc.AddFilter(filter);
            DataSet ds = boc.GetPagedRecords(pageIndex, pageSize, "PKID", (obType == Common.OrderByType.ASC)?true:false);

            totalCount = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
            return(ds.Tables[1]);
        }
示例#14
0
        public void Update()
        {
            BusinessMapping.CWNewMarrige bo = new BusinessMapping.CWNewMarrige();
            bo.SessionInstance = new Wicresoft.Session.Session();

            BusinessFilter filter = new BusinessFilter("CWNewMarrige");

            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.MaleIDCardNo.Value    = this.txtMaleIDCardNo.Text.Trim();
                bo.MaleName.Value        = this.txtMaleName.Text.Trim();
                bo.MaleAddress.Value     = this.txtMaleAddress.Text.Trim();
                bo.MaleLinkPhone.Value   = this.txtMaleLinkPhone.Text.Trim();
                bo.FemaleIDCardNo.Value  = this.txtFemaleIDCardNo.Text.Trim();
                bo.FemaleName.Value      = this.txtFemaleName.Text.Trim();
                bo.FemaleAddress.Value   = this.txtFemaleAddress.Text.Trim();
                bo.FemaleLinkPhone.Value = this.txtFemaleLinkPhone.Text.Trim();
                if (this.txtMarrigeDate.Text != "")
                {
                    bo.MarrigeDate.Value = Convert.ToDateTime(this.txtMarrigeDate.Text);
                }

                if (this.ddlIsPregnant.SelectedValue != string.Empty && this.ddlIsPregnant.SelectedValue != "0")
                {
                    bo.IsPregnant.Value = Convert.ToInt32(this.ddlIsPregnant.SelectedValue);
                }
                else
                {
                    bo.IsPregnant.Value = 0;
                }

                if (this.txtExpectDate.Text != "")
                {
                    bo.ExpectDate.Value = Convert.ToDateTime(this.txtExpectDate.Text);
                }

                if (this.txtVillageDate.Text != "")
                {
                    bo.VillageDate.Value = Convert.ToDateTime(this.txtVillageDate.Text);
                }

                bo.MarrigeNo.Value = this.txtMarrigeNo.Text.Trim();

                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 CWNewMarrige SET MarrigeDate = NULL WHERE PKID = {0}; ", this.PKID);
                }
                if (this.txtExpectDate.Text == "" && bo.ExpectDate.Value != DateTime.MinValue)
                {
                    strSql += string.Format("UPDATE CWNewMarrige SET ExpectDate = NULL WHERE PKID = {0}; ", this.PKID);
                }
                if (this.txtVillageDate.Text == "" && bo.VillageDate.Value != DateTime.MinValue)
                {
                    strSql += string.Format("UPDATE CWNewMarrige SET VillageDate = NULL WHERE PKID = {0}; ", this.PKID);
                }
                if (strSql != string.Empty)
                {
                    Wicresoft.Session.Session session = new Wicresoft.Session.Session();

                    session.SqlHelper.ExecuteNonQuery(strSql, CommandType.Text);
                }
            }
        }
示例#15
0
        public void Update()
        {
            BusinessMapping.CWOneChild bo = new BusinessMapping.CWOneChild();
            bo.SessionInstance = new Wicresoft.Session.Session();

            BusinessFilter filter = new BusinessFilter("CWOneChild");

            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.ChildName.Value = this.txtChildName.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;
                }

                bo.FathIDCardNo.Value = this.txtFathIDCardNo.Text.Trim();
                bo.MothIDCardNo.Value = this.txtMothIDCardNo.Text.Trim();
                bo.OneChildNo.Value   = this.txtOneChildNo.Text.Trim();
                bo.IssueOrg.Value     = this.txtIssueOrg.Text.Trim();
                if (this.txtBirthDate.Text != "")
                {
                    bo.BirthDate.Value = Convert.ToDateTime(this.txtBirthDate.Text);
                }

                bo.InSchool.Value      = this.txtInSchool.Text.Trim();
                bo.FamilyAddress.Value = this.txtFamilyAddress.Text.Trim();
                if (this.txtFamilyIncome.Text.Trim() != "")
                {
                    bo.FamilyIncome.Value = Convert.ToDecimal(this.txtFamilyIncome.Text.Trim());
                }

                bo.InsuNo.Value = this.txtInsuNo.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.txtBirthDate.Text == "" && bo.BirthDate.Value != DateTime.MinValue)
                {
                    strSql += string.Format("UPDATE CWOneChild SET BirthDate = NULL WHERE PKID = {0}; ", this.PKID);
                }
                if (strSql != string.Empty)
                {
                    Wicresoft.Session.Session session = new Wicresoft.Session.Session();

                    session.SqlHelper.ExecuteNonQuery(strSql, CommandType.Text);
                }
            }
        }
示例#16
0
        public void Update()
        {
            BusinessMapping.CWOneChildAward bo = new BusinessMapping.CWOneChildAward();
            bo.SessionInstance = new Wicresoft.Session.Session();

            BusinessFilter filter = new BusinessFilter("CWOneChildAward");

            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.OwnIDCardNo.Value   = this.txtOwnIDCardNo.Text.Trim();
                bo.OwnName.Value       = this.txtOwnName.Text.Trim();
                bo.ChildIDCardNo.Value = this.txtChildIDCardNo.Text.Trim();
                bo.ChildName.Value     = this.txtChildName.Text.Trim();
                if (this.txtBirthDate.Text != "")
                {
                    bo.BirthDate.Value = Convert.ToDateTime(this.txtBirthDate.Text);
                }

                bo.OneChildNo.Value = this.txtOneChildNo.Text.Trim();
                if (this.txtRealMonth.Text.Trim() != "")
                {
                    bo.RealMonth.Value = Convert.ToInt32(this.txtRealMonth.Text.Trim());
                }

                if (this.txtAwardFee.Text.Trim() != "")
                {
                    bo.AwardFee.Value = Convert.ToDecimal(this.txtAwardFee.Text.Trim());
                }

                bo.LinkPhone.Value    = this.txtLinkPhone.Text.Trim();
                bo.AuthName.Value     = this.txtAuthName.Text.Trim();
                bo.ABCNo.Value        = this.txtABCNo.Text.Trim();
                bo.AuthIDCardNo.Value = this.txtAuthIDCardNo.Text.Trim();
                bo.AwardYear.Value    = this.txtAwardYear.Text.Trim();

                bo.Memo.Value = this.txtMemo.Text.Trim();

                bo.Update();

                string strSql = string.Empty;

                if (this.txtBirthDate.Text == "" && bo.BirthDate.Value != DateTime.MinValue)
                {
                    strSql += string.Format("UPDATE CWOneChildAward SET BirthDate = NULL WHERE PKID = {0}; ", this.PKID);
                }
                if (strSql != string.Empty)
                {
                    Wicresoft.Session.Session session = new Wicresoft.Session.Session();

                    session.SqlHelper.ExecuteNonQuery(strSql, CommandType.Text);
                }
            }
        }
示例#17
0
        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);
                }
            }
        }