예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                List <User> users = new List <User>();
                this.gvList.DataSource = users;
                this.gvList.DataBind();

                TB_CompanyService comSer = new TB_CompanyService();

                var comList = comSer.GetListArray("");
                comList.Insert(0, new VAN_OA.Model.BaseInfo.TB_Company()
                {
                    ComCode = "全部", ComName = "全部"
                });
                ddlCompany.DataSource = comList;
                ddlCompany.DataBind();


                var dt = DBHelp.getDataTable("select loginIPosition from tb_User group by loginIPosition ");
                ddlDepartment.Items.Add(new ListItem("全部"));
                foreach (DataRow dr in dt.Rows)
                {
                    ddlDepartment.Items.Add(new ListItem(dr[0].ToString()));
                }
            }
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request["GuestName"]))
            {
                string sql = string.Format("select Model FROM CG_POOrder WHERE GuestName='{0}' and Model<>'' and status='通过' group by Model", Request["GuestName"]);

                Response.Write(string.Join(",", DBHelp.getDataTable(sql).Select().Select(t => t[0].ToString()).ToArray()));
                Response.End();
                return;
            }
        }
예제 #3
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            if (tvMain.SelectedNode == null || tvMain.SelectedNode.Depth <= 0)
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "a", string.Format("alert('请选择一个文件夹节点进行删除!');"), true);
                return;
            }
            if (tvMain.SelectedNode.Depth == 0)
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "a", string.Format("alert('该文件夹节点无法删除!');"), true);
                return;
            }

            string sql = "Folder_ID in (";

            sql += string.Format("{0},", tvMain.SelectedNode.Target);
            for (int i = 0; i < tvMain.SelectedNode.ChildNodes.Count; i++)
            {
                sql += string.Format("{0},", tvMain.SelectedNode.ChildNodes[i].Target);
            }

            sql          = sql.Substring(0, sql.Length - 1);
            sql         += ")";
            lblMess.Text = "";
            //检测文件夹中是否有文件
            string    checkF = string.Format("select mainName,Folder_NAME from tb_Attachment left join tb_Folder on tb_Folder.Folder_ID=tb_Attachment.folder_Id where tb_Attachment." + sql);
            DataTable dt     = DBHelp.getDataTable(checkF);

            if (dt.Rows.Count > 0)
            {
                string message = "<br/>提示:<br/>";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (tvMain.SelectedNode.Text == dt.Rows[i]["Folder_NAME"].ToString())
                    {
                        message += string.Format("文件夹:{1},存在文件:{0}<br/>", dt.Rows[i]["mainName"].ToString(), dt.Rows[i]["Folder_NAME"].ToString());
                    }
                    else
                    {
                        message += string.Format("子文件夹:{1},存在文件:{0}<br/>", dt.Rows[i]["mainName"].ToString(), dt.Rows[i]["Folder_NAME"].ToString());
                    }
                }
                message     += string.Format("上述原因导致改文件夹({0})不能被删除", tvMain.SelectedNode.Text);
                lblMess.Text = message;
                //  ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "a", string.Format("alert('{0}!');",message), true);
                return;
            }
            else
            {
                string delete = "delete from tb_Folder where " + sql;
                DBHelp.ExeCommand(delete);

                ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "a", string.Format("alert('删除成功!');"), true);
                lblSonId.Visible  = false;
                lblPareId.Visible = false;
                lblParent.Text    = "&nbsp";
                txtFolder.Text    = "";
                btnSave.Enabled   = false;
                btnCancel.Enabled = false;
                IniData();
            }
        }