Exemple #1
0
    private void LoadData()
    {
        List <FineOffice.Modules.CNS_CensusRelation> relationList = relationBll.GetListAll();

        foreach (FineOffice.Modules.CNS_CensusRelation relation in relationList)
        {
            ddlRelation.Items.Add(relation.Relation, relation.Relation);
        }

        List <FineOffice.Modules.CNS_PoliticalAffiliation> affiliationList = affiliationBll.GetListAll();

        foreach (FineOffice.Modules.CNS_PoliticalAffiliation affiliation in affiliationList)
        {
            ddlPolitical.Items.Add(affiliation.Political, affiliation.ID.ToString());
        }

        List <FineOffice.Modules.AM_Kind> educationList = kindBll.GetList(d => d.KindID == 1);

        foreach (FineOffice.Modules.AM_Kind kind in educationList)
        {
            ddlEducation.Items.Add(kind.Name, kind.ID.ToString());
        }

        if (Request["ID"] != null)
        {
            int id = int.Parse(Request["ID"]);
            hiddenID.Text = Request["ID"];
            FineOffice.Modules.CNS_CensusMember model = memberBll.GetModel(d => d.ID == id);
            txtRegisterNO.Text         = model.RegisterNO;
            txtAddress.Text            = model.Address;
            dtpBrithday.Text           = string.Format("{0:yyyy-MM-dd}", model.Brithday);
            dtpCancelDate.Text         = string.Format("{0:yyyy-MM-dd}", model.CancelDate);
            txtCancelReason.Text       = model.CancelReason;
            txtCompany.Text            = model.Company;
            ddlEducation.SelectedValue = model.EducationID.ToString();
            txtHeight.Text             = model.Height;
            txtIDCard.Text             = model.IDCard;
            dtpIngoingDate.Text        = string.Format("{0:yyyy-MM-dd}", model.IngoingDate);
            txtIngoingReason.Text      = model.IngoingReason;
            chkIsCanceled.Checked      = model.IsCanceled.Value;
            txtMarriage.Text           = model.Marriage;
            txtMilitaryService.Text    = model.MilitaryService;
            dtpMoveOutDate.Text        = string.Format("{0:yyyy-MM-dd}", model.MoveOutDate);
            txtMoveToAddress.Text      = model.MoveToAddress;
            txtName.Text               = model.Name;
            txtNationalilty.Text       = model.Nationalilty;
            txtOccupation.Text         = model.Occupation;
            ddlPolitical.SelectedValue = model.PoliticalID.ToString();
            txtTypeOfBlood.Text        = model.TypeOfBlood;
            txtTel.Text               = model.Tel;
            ddlSex.SelectedValue      = model.Sex.ToString();
            txtReligion.Text          = model.Religion;
            txtOtherName.Text         = model.OtherName;
            ddlRelation.SelectedValue = model.Relation;
            txtPreviousAddress.Text   = model.PreviousAddress;
            txtPlaceOfAncestral.Text  = model.PlaceOfAncestral;
            txtPlaceOfBirth.Text      = model.PlaceOfBirth;
        }
    }
Exemple #2
0
    /// <summary>
    /// 保存导入数据
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        FineOffice.Common.Excel.ExcelHelper toExcel     = new FineOffice.Common.Excel.ExcelHelper();
        FineOffice.Web.WebExcelHelper       excelHelper = new FineOffice.Web.WebExcelHelper();
        string             serverPath = Server.MapPath("~/Config/Template/CNS_CensusMember.xml");
        List <ExcelHeader> headerList = toExcel.GetHeaderList(serverPath);

        try
        {
            foreach (GridRow row in gridMember.Rows)
            {
                gridMember.SelectedRowIndex = row.RowIndex;
                Dictionary <string, object> valueMap = new Dictionary <string, object>();
                foreach (GridColumn column in gridMember.Columns)
                {
                    FineUI.BoundField field = column as FineUI.BoundField;
                    string            value = row.Values[column.ColumnIndex].ToString();
                    if (field != null)
                    {
                        valueMap.Add(field.DataField, value);
                    }
                }
                FineOffice.Modules.CNS_CensusMember   model    = toExcel.Create <FineOffice.Modules.CNS_CensusMember>(headerList, valueMap);
                FineOffice.Modules.CNS_CensusRegister register = registerBll.GetModel(m => m.RegisterNO == model.RegisterNO);
                if (register == null)
                {
                    register             = new FineOffice.Modules.CNS_CensusRegister();
                    register.RegisterNO  = model.RegisterNO;
                    register.HouseHolder = model.HouseHolder;
                    FineOffice.Modules.CNS_CensusType type = typeBll.GetModel(t => t.CensusTypeName == model.CensusTypeName);
                    if (type == null)
                    {
                        type = new FineOffice.Modules.CNS_CensusType();
                        type.CensusTypeName = model.CensusTypeName;
                        type = typeBll.Add(type);
                    }
                    register.CensusTypeID = type.ID;
                    registerBll.Add(register);
                }
                if (model.Gender == "男")
                {
                    model.Sex = 1;
                }
                else
                {
                    model.Sex = 0;
                }

                FineOffice.Modules.CNS_PoliticalAffiliation political = politicalBll.GetModel(m => m.Political == model.Political);
                if (political == null)
                {
                    political           = new FineOffice.Modules.CNS_PoliticalAffiliation();
                    political.Political = model.Political;
                    political           = politicalBll.Add(political);
                }
                model.PoliticalID = political.ID;

                FineOffice.Modules.AM_Kind kind = kindBll.GetModel(m => m.Name == model.Education);
                if (kind != null)
                {
                    model.EducationID = kind.ID;
                }
                memberBll.Add(model);
            }
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference("member_close"));
        }
        catch (Exception ex)
        {
            FineUI.Alert.ShowInParent(ex.Message);
        }
    }
Exemple #3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string registerNO = txtRegisterNO.Text.Trim();

        if (registerBll.GetModel(r => r.RegisterNO == registerNO) == null)
        {
            FineUI.Alert.ShowInParent("该户号不存在!");
            return;
        }

        DateTime?brithday = null;

        if (dtpBrithday.Text.Length > 0)
        {
            brithday = DateTime.Parse(dtpBrithday.Text);
        }

        DateTime?cancelDate = null;

        if (dtpCancelDate.Text.Length > 0)
        {
            cancelDate = DateTime.Parse(dtpCancelDate.Text);
        }

        DateTime?ingoingDate = null;

        if (dtpIngoingDate.Text.Length > 0)
        {
            ingoingDate = DateTime.Parse(dtpIngoingDate.Text);
        }

        DateTime?moveOutDate = null;

        if (dtpMoveOutDate.Text.Length > 0)
        {
            moveOutDate = DateTime.Parse(dtpMoveOutDate.Text);
        }

        int id = int.Parse(hiddenID.Text);

        FineOffice.Modules.CNS_CensusMember model = memberBll.GetModel(d => d.ID == id);

        model.Address          = txtAddress.Text.Trim();
        model.Brithday         = brithday;
        model.CancelDate       = cancelDate;
        model.CancelReason     = txtCancelReason.Text.Trim();
        model.Company          = txtCompany.Text.Trim();
        model.EducationID      = int.Parse(ddlEducation.SelectedValue);
        model.Height           = txtHeight.Text.Trim();
        model.IDCard           = txtIDCard.Text.Trim();
        model.IngoingDate      = ingoingDate;
        model.IngoingReason    = txtIngoingReason.Text.Trim();
        model.IsCanceled       = chkIsCanceled.Checked;
        model.Marriage         = txtMarriage.Text.Trim();
        model.MilitaryService  = txtMilitaryService.Text.Trim();
        model.MoveOutDate      = moveOutDate;
        model.MoveToAddress    = txtMoveToAddress.Text.Trim();
        model.Name             = txtName.Text.Trim();
        model.Nationalilty     = txtNationalilty.Text.Trim();
        model.Occupation       = txtOccupation.Text.Trim();
        model.PoliticalID      = int.Parse(ddlPolitical.SelectedValue);
        model.TypeOfBlood      = txtTypeOfBlood.Text.Trim();
        model.Tel              = txtTel.Text.Trim();
        model.Sex              = short.Parse(ddlSex.SelectedValue);
        model.Religion         = txtReligion.Text.Trim();
        model.OtherName        = txtOtherName.Text.Trim();
        model.Relation         = ddlRelation.SelectedText;
        model.PreviousAddress  = txtPreviousAddress.Text.Trim();
        model.PlaceOfAncestral = txtPlaceOfAncestral.Text.Trim();
        model.PlaceOfBirth     = txtPlaceOfBirth.Text.Trim();
        model.RegisterNO       = txtRegisterNO.Text.Trim();
        memberBll.Update(model);
        PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference("member_close"));
    }