Ejemplo n.º 1
0
        private void btnDel_Click(object sender, ImageClickEventArgs e)
        {
            string PKID;
            int    selectedIndex = -1;

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

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

                if (bo.HaveRecord)
                {
                    bo.IsValid.Value = false;
                    bo.Update();

                    // Reload Data
                    ucCustomPaging.LoadData(ucCustomPaging.CurrentPage);
                }
            }
        }
Ejemplo n.º 2
0
        public void LoadBaseInfo(int pkid)
        {
            BusinessMapping.CWOneChildAward bo = new BusinessMapping.CWOneChildAward();
            bo.SessionInstance = new Wicresoft.Session.Session();

            BusinessFilter filter = new BusinessFilter("CWOneChildAward");

            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.txtOwnIDCardNo.Text   = bo.OwnIDCardNo.Value;
                this.txtOwnName.Text       = bo.OwnName.Value;
                this.txtChildIDCardNo.Text = bo.ChildIDCardNo.Value;
                this.txtChildName.Text     = bo.ChildName.Value;
                if (bo.BirthDate.Value != DateTime.MinValue)
                {
                    this.txtBirthDate.Text = bo.BirthDate.Value.ToString("yyyy-MM-dd");
                }

                this.txtOneChildNo.Text   = bo.OneChildNo.Value;
                this.txtRealMonth.Text    = bo.RealMonth.Value.ToString();
                this.txtAwardFee.Text     = bo.AwardFee.Value.ToString();
                this.txtLinkPhone.Text    = bo.LinkPhone.Value;
                this.txtAuthName.Text     = bo.AuthName.Value;
                this.txtABCNo.Text        = bo.ABCNo.Value;
                this.txtAuthIDCardNo.Text = bo.AuthIDCardNo.Value;
                this.txtAwardYear.Text    = bo.AwardYear.Value;
                this.txtMemo.Text         = bo.Memo.Value;
            }
        }
Ejemplo n.º 3
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);
                }
            }
        }