Example #1
0
    private void LoadData()
    {
        if (Request["ID"] == null)
        {
            return;
        }
        int id = int.Parse(Request["ID"].ToString());

        hiddenID.Text = id.ToString();
        FineOffice.Modules.CNS_PoliticalAffiliation model = politicalBll.GetModel(d => d.ID == id);
        txtPolitical.Text = model.Political;
    }
Example #2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         FineOffice.Modules.CNS_PoliticalAffiliation model = politicalBll.GetModel(d => d.ID == int.Parse(hiddenID.Text));
         model.Political = txtPolitical.Text.Trim();
         politicalBll.Update(model);
     }
     catch (Exception ex)
     {
         Alert.Show(ex.Message);
     }
     PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference("subwin_close"));
 }
Example #3
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);
        }
    }