Example #1
0
    protected void btnok_Click(object sender, EventArgs e)
    {
        XYECOM.Business.UserType ut = new XYECOM.Business.UserType();
        XYECOM.Model.UserTypeInfo eu1 = new XYECOM.Model.UserTypeInfo();
        eu1.UT_PID = UT_PID;
        int err = 0;
        string url = "UserTypelist.aspx";
        if (UT_ID == 0)
        {
            string TypeName = tbName.Text.Trim().Replace(",", ",");

            if (TypeName.Trim().Equals(""))
            {
                Alert("请输入分类名称!");
                return;
            }

            string[] arr = TypeName.Split(',');
            int num = 0;

            string errMessage = "";

            for (int i = 0; i < arr.Length; i++)
            {
                XYECOM.Model.UserTypeInfo eu = new XYECOM.Model.UserTypeInfo();
                eu.UT_Type = arr[i].Trim();
                eu.UT_PID = UT_PID;
                err = ut.Insert(eu);
                if(err==1)
                {
                    num += 1;
                }
                else if (err == -1)
                {
                    errMessage += "[" + arr[i].Trim() + "]已存在!<br/>";
                    continue;
                }
                else
                {
                    errMessage += "[" + arr[i].Trim() + "]添加失败!<br/>";
                    continue;
                }
            }

            if (!errMessage.Equals("") && num >0)
            {
                Alert(errMessage,url);
                return;
            }

            if (!errMessage.Equals(""))
            {
                Alert(errMessage);
            }

            if (num > 0) Response.Redirect(url);
        }
        else
        {
            string TypeName1 = tbName.Text.Trim().Replace(",", ",");
            string[] arr = TypeName1.Split(',');
            if (arr.Length > 1)
            {
                Alert("填写不正确!", url);
            }
            else {
                eu1.UT_Type = this.tbName.Text;
                eu1.UT_ID = UT_ID;
                err = ut.Update(eu1);
                if (err > 0)
                {
                    Response.Redirect(url);
                }
                else
                {
                    Alert("修改失败!", url);
                }
            }
        }
    }
Example #2
0
    private void CreateCompanyTypeHTML(int UT_ID)
    {
        try
        {
            string str = "";
            string strlist = "";
            XYECOM.Business.UserType ut = new XYECOM.Business.UserType();
            XYECOM.Model.UserTypeInfo et = new XYECOM.Model.UserTypeInfo();
            if (UT_ID == 0)
            {
                str += "请选择企业类别";
                strlist += "<a href=\"#\" onclick=\"selectcompanytypelist(0,this);\">请选择企业类别</a>";
            }
            else
            {
                et = ut.GetItem(UT_ID);

                str += et.UT_Type.ToString();
                strlist += "<a href=\"#\" onclick=\"selectcompanytypelist(" + et.UT_ID.ToString() + ",this);\">" + et.UT_Type.ToString() + "</a>";
            }

            str += "$";
            DataTable dt;
            dt = ut.GetDataTable(UT_ID);
            DataTable dt1 = ut.GetDataTable(-1);

            if (dt.Rows.Count > 0)
            {
                strlist += " <ul class=\"subset\">";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    str += "    <a href=\"#\" title=\"点击选择此项\" onclick=\"selectcompanytypeinfo(" + dt.Rows[i]["UT_ID"].ToString() + ",'" + dt.Rows[i]["UT_Type"].ToString() + "');\">" + dt.Rows[i]["UT_Type"].ToString() + "</a>";
                    strlist += "<li class=\"";
                    dt1.DefaultView.RowFilter = "UT_PID=" + dt.Rows[i]["UT_ID"].ToString();
                    DataView dv1 = dt1.DefaultView;
                    if (dv1.Count > 0)
                        strlist += "shrink\" ><a href=\"#\" onclick=\"selectcompanytypelist(" + dt.Rows[i]["UT_ID"].ToString() + ",this);\">" + dt.Rows[i]["UT_Type"].ToString() + "</a></li>";
                    else
                        strlist += "sublast\" >" + dt.Rows[i]["UT_Type"].ToString() + "</li>";

                }
                strlist += "</ul>";
            }
            else
            {
                str += " ";
            }
            str += "$";
            str += strlist;
            Response.Write(str);
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message.Replace("\n", ""));
        }
    }
Example #3
0
    private void InitPage()
    {
        if (this.Request.QueryString["UT_PID"] != null && this.Request.QueryString["UT_PID"].ToString() != "")
        {
            if (Request.QueryString["UT_PID"].ToString() != "0")
            {
                XYECOM.Business.UserType ut = new XYECOM.Business.UserType();

                long typeId = XYECOM.Core.XYRequest.GetQueryInt64("UT_PID");

                DataTable dt = ut.GetDataTable(typeId);

                if (dt.Rows.Count > 0)
                {
                    lblName.Text = dt.Rows[0]["UT_Type"].ToString();
                }
            }
            else
                lblName.Text = "一级企业类型";
            UT_PID = Convert.ToInt64(Request.QueryString["UT_PID"].ToString());
        }
        if (this.Request.QueryString["UT_ID"] != null && this.Request.QueryString["UT_ID"].ToString() != "")
        {
            XYECOM.Business.UserType ut = new XYECOM.Business.UserType();
            XYECOM.Model.UserTypeInfo eu = new XYECOM.Model.UserTypeInfo();

            eu = ut.GetItem(Convert.ToInt64(this.Request.QueryString["UT_ID"].ToString()));

            UT_ID = eu.UT_ID;
            this.tbName.Text = eu.UT_Type;
             UT_PID = eu.UT_PID;
            if (UT_PID != 0)
            {
                eu = ut.GetItem(UT_PID);
                this.lblName.Text = eu.UT_Type;
            }
            else
            {
                this.lblName.Text = "一级企业类型";
            }
            this.lbremark.Visible = false;
            this.lblName.Text = "企业类型编辑";
        }
    }