Ejemplo n.º 1
0
        protected String GetName(int id)
        {
            switch (this.selectid)
            {
            case "1":
                bll_province = new BLL.CCOM.Province();
                return(bll_province.GetModel(" " + selectIndex + "=" + id).Province_name);

            case "2":
                bll_politics = new BLL.CCOM.Politics();
                return(bll_politics.GetModel(" " + selectIndex + "=" + id).Politics_name);

            case "3":
                bll_nationality = new BLL.CCOM.Nationality();
                return(bll_nationality.GetModel(" " + selectIndex + "=" + id).Nationality_name);

            case "4":
                bll_nation = new BLL.CCOM.Nation();
                return(bll_nation.GetModel(" " + selectIndex + "=" + id).Nation_name);

            case "5":
                bll_musical_instrument = new BLL.CCOM.Musical_instrument();
                return(bll_musical_instrument.GetModel(" " + selectIndex + "=" + id).Mi_name);

            case "6":
                bll_degree = new BLL.CCOM.Degree();
                return(bll_degree.GetModel(" " + selectIndex + "=" + id).Degree_name);

            case "7":
                bll_certivicate_type = new BLL.CCOM.Certificate_type();
                return(bll_certivicate_type.GetModel(" " + selectIndex + "=" + id).Ct_name);

            default:
                return("");
            }
        }
Ejemplo n.º 2
0
        protected string ImportDataItem(DataSet ds, ref int success, ref int error)//基础数据
        {
            string result = "";

            BLL.CCOM.Province             bll_Province             = new BLL.CCOM.Province();
            Model.CCOM.Province           model_Province           = new Model.CCOM.Province();
            BLL.CCOM.Politics             bll_Politics             = new BLL.CCOM.Politics();
            Model.CCOM.Politics           model_Politics           = new Model.CCOM.Politics();
            BLL.CCOM.Nationality          bll_Nationality          = new BLL.CCOM.Nationality();
            Model.CCOM.Nationality        model_Nationality        = new Model.CCOM.Nationality();
            BLL.CCOM.Nation               bll_Nation               = new BLL.CCOM.Nation();
            Model.CCOM.Nation             model_Nation             = new Model.CCOM.Nation();
            BLL.CCOM.Musical_instrument   bll_Musical_instrument   = new BLL.CCOM.Musical_instrument();
            Model.CCOM.Musical_instrument model_Musical_instrument = new Model.CCOM.Musical_instrument();
            BLL.CCOM.Degree               bll_Degree               = new BLL.CCOM.Degree();
            Model.CCOM.Degree             model_Degree             = new Model.CCOM.Degree();
            BLL.CCOM.Certificate_type     bll_Certificate_type     = new BLL.CCOM.Certificate_type();
            Model.CCOM.Certificate_type   model_Certificate_type   = new Model.CCOM.Certificate_type();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string checkmsg = null;
                string name     = ds.Tables[0].Rows[i]["名称"].ToString().Trim();
                if (!ValidDFValue(name, true, "", ref checkmsg))
                {
                    result += "×第" + (i + 1).ToString() + "行数据更新失败,名称" + checkmsg + "<br/>";
                    error++;
                    continue;
                }
                switch (this.ddlResourceType.SelectedValue)
                {
                case "1":
                    if (name != "")
                    {
                        model_Province.Province_name = name;
                    }
                    if (bll_Province.GetModel(" Province_name='" + name + "'") != null)
                    {
                        result += "×第" + (i + 1).ToString() + "行,系统已存在该数据<br/>";
                        error++;
                        continue;
                    }
                    else if (bll_Province.Add(model_Province) == 0)
                    {
                        result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>";
                        error++;
                        continue;
                    }
                    else
                    {
                        success++;
                    }
                    break;

                case "2":
                    if (name != "")
                    {
                        model_Politics.Politics_name = name;
                    }
                    if (bll_Politics.GetModel(" Politics_name='" + name + "'") != null)
                    {
                        result += "×第" + (i + 1).ToString() + "行,系统已存在该数据<br/>";
                        error++;
                        continue;
                    }
                    else if (bll_Politics.Add(model_Politics) == 0)
                    {
                        result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>";
                        error++;
                        continue;
                    }
                    else
                    {
                        success++;
                    }
                    break;

                case "3":
                    if (name != "")
                    {
                        model_Nationality.Nationality_name = name;
                    }
                    if (bll_Nationality.GetModel(" Nationality_name='" + name + "'") != null)
                    {
                        result += "×第" + (i + 1).ToString() + "行,系统已存在该数据<br/>";
                        error++;
                        continue;
                    }
                    else if (bll_Nationality.Add(model_Nationality) == 0)
                    {
                        result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>";
                        error++;
                        continue;
                    }
                    else
                    {
                        success++;
                    }
                    break;

                case "4":
                    if (name != "")
                    {
                        model_Nation.Nation_name = name;
                    }
                    if (bll_Nation.GetModel(" Nation_name='" + name + "'") != null)
                    {
                        result += "×第" + (i + 1).ToString() + "行,系统已存在该数据<br/>";
                        error++;
                        continue;
                    }
                    else if (bll_Nation.Add(model_Nation) == 0)
                    {
                        result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>";
                        error++;
                        continue;
                    }
                    else
                    {
                        success++;
                    }
                    break;

                case "5":
                    if (name != "")
                    {
                        model_Musical_instrument.Mi_name = name;
                    }
                    if (bll_Musical_instrument.GetModel(" Mi_name='" + name + "'") != null)
                    {
                        result += "×第" + (i + 1).ToString() + "行,系统已存在该数据<br/>";
                        error++;
                        continue;
                    }
                    else if (bll_Musical_instrument.Add(model_Musical_instrument) == 0)
                    {
                        result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>";
                        error++;
                        continue;
                    }
                    else
                    {
                        success++;
                    }
                    break;

                case "6":
                    if (name != "")
                    {
                        model_Degree.Degree_name = name;
                    }
                    if (bll_Degree.GetModel(" Degree_name='" + name + "'") != null)
                    {
                        result += "×第" + (i + 1).ToString() + "行,系统已存在该数据<br/>";
                        error++;
                        continue;
                    }
                    else if (bll_Degree.Add(model_Degree) == 0)
                    {
                        result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>";
                        error++;
                        continue;
                    }
                    else
                    {
                        success++;
                    }
                    break;

                case "7":
                    if (name != "")
                    {
                        model_Certificate_type.Ct_name = name;
                    }
                    if (bll_Certificate_type.GetModel(" Ct_name='" + name + "'") != null)
                    {
                        result += "×第" + (i + 1).ToString() + "行,系统已存在该数据<br/>";
                        error++;
                        continue;
                    }
                    else if (bll_Certificate_type.Add(model_Certificate_type) == 0)
                    {
                        result += "×第" + (i + 1).ToString() + "行数据更新异常<br/>";
                        error++;
                        continue;
                    }
                    else
                    {
                        success++;
                    }
                    break;

                default:
                    break;
                }
            }
            return(result);
        }