예제 #1
0
        public void LoadBaseInfo(int pkid)
        {
            BusinessMapping.CWNewMarrige bo = new BusinessMapping.CWNewMarrige();
            bo.SessionInstance = new Wicresoft.Session.Session();

            BusinessFilter filter = new BusinessFilter("CWNewMarrige");

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

                if (bo.IsPregnant.Value > 0)
                {
                    this.ddlIsPregnant.SelectedValue = bo.IsPregnant.Value.ToString();
                }

                if (bo.ExpectDate.Value != DateTime.MinValue)
                {
                    this.txtExpectDate.Text = bo.ExpectDate.Value.ToString("yyyy-MM-dd");
                }

                if (bo.VillageDate.Value != DateTime.MinValue)
                {
                    this.txtVillageDate.Text = bo.VillageDate.Value.ToString("yyyy-MM-dd");
                }

                this.txtMarrigeNo.Text = bo.MarrigeNo.Value;
                this.txtMemo.Text      = bo.Memo.Value;
            }
        }
예제 #2
0
        public void Save()
        {
            int userID = GlobalFacade.SystemContext.GetContext().UserID;

            BusinessMapping.CWNewMarrige bo = new BusinessMapping.CWNewMarrige();
            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.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);
            }

            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.CreateUser.Value = userID;
            bo.CreateTime.Value = DateTime.Now;
            bo.Memo.Value       = this.txtMemo.Text.Trim();

            bo.Insert();
        }
예제 #3
0
        private void btnDel_Click(object sender, ImageClickEventArgs e)
        {
            string PKID;
            int    selectedIndex = -1;

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

                BusinessFilter filter = new BusinessFilter("CWNewMarrige");
                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);
                }
            }
        }
예제 #4
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);
                }
            }
        }