Пример #1
0
        public void Save()
        {
            int userID = GlobalFacade.SystemContext.GetContext().UserID;

            BusinessMapping.CWOneChild bo = new BusinessMapping.CWOneChild();
            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.ChildName.Value = this.txtChildName.Text.Trim();
            if (this.ddlSex.SelectedValue != string.Empty && this.ddlSex.SelectedValue != "0")
            {
                bo.Sex.Value = Convert.ToInt32(this.ddlSex.SelectedValue);
            }

            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.CreateUser.Value = userID;
            bo.CreateTime.Value = DateTime.Now;

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

            bo.Insert();
        }
Пример #2
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);
                }
            }
        }
Пример #3
0
        public void LoadBaseInfo(int pkid)
        {
            BusinessMapping.CWOneChild bo = new BusinessMapping.CWOneChild();
            bo.SessionInstance = new Wicresoft.Session.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)
            {
                if (bo.FK_CWID.Value > 0)
                {
                    this.gpCWInfo.SelectedValue = bo.FK_CWID.Value.ToString();
                }
                this.txtIDCardNo.Text  = bo.IDCardNo.Value;
                this.txtChildName.Text = bo.ChildName.Value;
                if (bo.Sex.Value > 0)
                {
                    this.ddlSex.SelectedValue = bo.Sex.Value.ToString();
                }
                this.txtFathIDCardNo.Text = bo.FathIDCardNo.Value;
                this.txtMothIDCardNo.Text = bo.MothIDCardNo.Value;
                this.txtOneChildNo.Text   = bo.OneChildNo.Value;
                this.txtIssueOrg.Text     = bo.IssueOrg.Value;
                if (bo.BirthDate.Value != DateTime.MinValue)
                {
                    this.txtBirthDate.Text = bo.BirthDate.Value.ToString("yyyy-MM-dd");
                }

                this.txtInSchool.Text      = bo.InSchool.Value;
                this.txtFamilyAddress.Text = bo.FamilyAddress.Value;
                this.txtFamilyIncome.Text  = bo.FamilyIncome.Value.ToString();
                this.txtInsuNo.Text        = bo.InsuNo.Value;
                this.txtMemo.Text          = bo.Memo.Value;
            }
        }
Пример #4
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);
                }
            }
        }