Ejemplo n.º 1
0
        private bool DoAdd()
        {
            try
            {
                Model.department model = new Model.department();
                BLL.department   bll   = new BLL.department();

                model.department_name = txtTitle.Text.Trim();
                model.sort_id         = int.Parse(txtSortId.Text.Trim());
                model.is_lock         = 0;
                if (cbIsLock.Checked == true)
                {
                    model.is_lock = 1;
                }
                model.remark    = txtRemark.Text.Trim();
                model.parent_id = int.Parse(ddlParentId.SelectedValue);

                if (bll.Add(model) > 0)
                {
                    AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加部门信息:" + model.department_name); //记录日志
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }
Ejemplo n.º 2
0
        protected void ddlParentId_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList ddl = (DropDownList)sender;

            if (ddl.SelectedValue != "0")
            {
                Model.department de = new BLL.department().GetModel(int.Parse(ddl.SelectedValue));
                if (de.de_isGroup.Value)
                {
                    dlgroup.Visible    = false;
                    dlsubtitle.Visible = true;
                    dlarea.Visible     = true;
                    initData();
                }
                else
                {
                    string _treeText = string.Empty, _treeid = string.Empty;
                    new BLL.department().getDepartText(int.Parse(ddl.SelectedValue), out _treeText, out _treeid, out string area);
                    labDepartText.Text = _treeText;
                    dlsubtitle.Visible = false;
                    dlarea.Visible     = false;
                    dlgroup.Visible    = false;
                    initData(2);
                }
            }
            else
            {
                dlgroup.Visible    = true;
                dlsubtitle.Visible = true;
                dlarea.Visible     = true;
                initData(1);
            }
        }
Ejemplo n.º 3
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            PrintLoad();
            ChkAdminLevel("sys_department", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            BLL.department bll = new BLL.department();
            string         result = "";
            int            success = 0, error = 0;
            StringBuilder  sb = new StringBuilder();

            manager = GetAdminInfo();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    result = bll.Delete(id, manager);
                    if (result == "")
                    {
                        success++;
                    }
                    else
                    {
                        error++;
                        sb.Append(result + "<br/>");
                    }
                }
            }
            JscriptMsg("共选择" + (success + error) + "条记录,成功" + success + "条,失败" + error + "条<br/>" + sb.ToString(), "department_list.aspx");
        }
Ejemplo n.º 4
0
        //删除导航
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("department_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            BLL.department   bll     = new BLL.department();
            Agp2pDataContext context = new Agp2pDataContext();

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    bll.Delete(id);

                    var groupDepartments = context.li_user_group_departments.Where(w => w.department_id == id).ToList();
                    foreach (var tr in groupDepartments)
                    {
                        context.li_user_group_departments.DeleteOnSubmit(tr);
                    }

                    var managers = context.dt_manager.Where(w => w.department_id == id).ToList();
                    foreach (var m in managers)
                    {
                        m.department_id = 0;
                        m.is_default    = 0;
                    }
                }
            }
            context.SubmitChanges();
            AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除部门信息"); //记录日志
            JscriptMsg("删除数据成功!", "department_list.aspx", "Success", "parent.loadMenuTree");
        }
Ejemplo n.º 5
0
        private void get_DepartText(HttpContext context)
        {
            int    id = DTRequest.GetQueryInt("departid");
            int    oldid = DTRequest.GetQueryInt("olddepartid", 0);
            string textTree = "", idTree = "", username = "";

            new BLL.department().getDepartText(id, out textTree, out idTree, out string area);
            if (oldid == 0)
            {
                //新增时要生成新的工号
                username = new BLL.department().getNewUserName(area);
            }
            else
            {
                //编辑时当原来的区域和新的区域不一致时,要生成新的工号
                new BLL.department().getDepartText(oldid, out string oldtextTree, out string oldidTree, out string oldarea);
                if (area != oldarea)
                {
                    username = new BLL.department().getNewUserName(area);
                }
            }
            context.Response.Write("{ \"textTree\":\"" + textTree + "\", \"idTree\":\"" + idTree + "\", \"username\":\"" + username + "\" }");
            context.Response.End();
            return;
        }
Ejemplo n.º 6
0
        private void ShowInfo(int _id)
        {
            BLL.department   bll   = new BLL.department();
            Model.department model = bll.GetModel(_id);

            ddlParentId.SelectedValue = model.parent_id.ToString();
            txtSortId.Text            = model.sort_id.ToString();
            if (model.is_lock == 1)
            {
                cbIsLock.Checked = true;
            }

            txtTitle.Text = model.department_name;
            txtTitle.Attributes.Add("ajaxurl", "../../tools/admin_ajax.ashx?action=department_validate&old_name=" + Utils.UrlEncode(model.department_name));
            txtTitle.Focus(); //设置焦点,防止JS无法提交
            if (model.is_sys == 1)
            {
                ddlParentId.Enabled = false;
                txtTitle.ReadOnly   = true;
            }
            txtRemark.Text = model.remark;

            this.page = DTRequest.GetQueryInt("page", 1);
            //txtKeywords.Text = this.keywords;
            BLL.manager bllManager = new BLL.manager();
            this.rptList.DataSource = bllManager.GetList(this.pageSize, this.page, "department_id=" + _id + "", "add_time asc,id desc", out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("department_edit.aspx", "page={0}&action={1}&id={2}", "__id__", "pagedepartment", _id.ToString());

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Ejemplo n.º 7
0
        private void NewShowInfo()
        {
            btnDstatus.Visible       = false;
            btnFlag.Visible          = false;
            btnLockstatus.Visible    = false;
            btnUpdateCost.Visible    = false;
            btnUnBusinessPay.Visible = false;
            btnReceiptPay.Visible    = false;
            //btnPay.Visible = false;
            btnInvoince.Visible = false;
            //btnExcelIn.Visible = false;

            //默认生成下单人的活动归属地
            Dictionary <string, string> areaDic      = new BLL.department().getAreaDict();
            Dictionary <string, string> orderAreaDic = new Dictionary <string, string>();

            orderAreaDic.Add(manager.area, areaDic[manager.area]);
            rptAreaList.DataSource = orderAreaDic;
            rptAreaList.DataBind();

            //默认下单人
            DataTable pdt = new DataTable();

            pdt.Columns.Add("op_number");
            pdt.Columns.Add("op_name");
            pdt.Columns.Add("op_area");
            DataRow pdr = pdt.NewRow();

            pdr["op_number"] = manager.user_name;
            pdr["op_name"]   = manager.real_name;
            pdr["op_area"]   = manager.area;
            pdt.Rows.Add(pdr);
            rptEmployee0.DataSource = pdt;
            rptEmployee0.DataBind();
        }
Ejemplo n.º 8
0
 private string DoEdit(int _id)
 {
     try
     {
         BLL.department   bll   = new BLL.department();
         Model.department model = bll.GetModel(_id);
         manager = GetAdminInfo();
         string content = string.Empty;
         model.de_type     = string.IsNullOrEmpty(ddltype.SelectedValue) ? (byte)0 : Utils.ObjToByte(ddltype.SelectedValue);
         model.de_parentid = int.Parse(ddlParentId.SelectedValue);
         if (model.de_name != txtTitle.Text.Trim())
         {
             content += "机构名称:" + model.de_name + "→<font color='red'>" + txtTitle.Text.Trim() + "</font><br/>";
         }
         model.de_name = txtTitle.Text.Trim();
         if (model.de_isUse != cbIsUse.Checked)
         {
             content += "状态:" + Common.BusinessDict.isUseStatus(1)[model.de_isUse] + "→<font color='red'>" + Common.BusinessDict.isUseStatus(1)[cbIsUse.Checked] + "</font>";
         }
         model.de_isUse = cbIsUse.Checked;
         model.de_sort  = Convert.ToInt32(txtSortId.Text.Trim());
         return(bll.Update(model, content, manager.user_name, manager.real_name));
     }
     catch (Exception e)
     {
         return(e.Message);
     }
 }
Ejemplo n.º 9
0
        private void TreeBind()
        {
            BLL.department bll = new BLL.department();
            DataTable      dt  = bll.GetList(0);

            this.ddlDepartment.Items.Clear();
            this.ddlDepartment.Items.Add(new ListItem("无父级部门", "0"));
            foreach (DataRow dr in dt.Rows)
            {
                string Id         = dr["id"].ToString();
                int    ClassLayer = int.Parse(dr["class_layer"].ToString());
                string Title      = dr["department_name"].ToString().Trim();

                if (ClassLayer == 1)
                {
                    this.ddlDepartment.Items.Add(new ListItem(Title, Id));
                }
                else
                {
                    Title = "├ " + Title;
                    Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title;
                    this.ddlDepartment.Items.Add(new ListItem(Title, Id));
                }
            }
        }
Ejemplo n.º 10
0
        //数据绑定
        private void RptBind()
        {
            BLL.department bll = new BLL.department();
            DataTable      dt  = bll.GetLists(0);

            this.rptList.DataSource = dt;
            this.rptList.DataBind();
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public string Update(Model.manager model, string content, Model.manager manager, bool flag = true, bool updateName = false, bool updateContact = false)
        {
            if (model.role_id == 0)
            {
                return("请选择用户角色");
            }
            if (string.IsNullOrEmpty(model.user_name))
            {
                return("用户名不能为空");
            }
            if (Exists(model.user_name, model.id))
            {
                return("用户名已经存在");
            }
            if (string.IsNullOrEmpty(model.password))
            {
                return("密码不能为空");
            }
            if (string.IsNullOrEmpty(model.real_name))
            {
                return("姓名不能为空");
            }
            if (string.IsNullOrEmpty(model.telephone))
            {
                return("电话不能为空");
            }
            if (flag)
            {
                if (model.departID == 0)
                {
                    return("岗位不能为空");
                }
                Model.department de = new BLL.department().GetModel(model.departID);
                if (de == null)
                {
                    return("岗位不存在");
                }
                if (de.de_type != 3)
                {
                    return("请选择到岗位级别");
                }
            }
            model.user_name = model.user_name.ToUpper();
            model.area      = model.area.ToUpper();
            string result = dal.Update(model, updateName, updateContact);

            if (string.IsNullOrEmpty(result))
            {
                Model.business_log logmodel = new Model.business_log();
                logmodel.ol_relateID    = model.id;
                logmodel.ol_title       = "编辑用户";
                logmodel.ol_content     = content;
                logmodel.ol_operateDate = DateTime.Now;
                new business_log().Add(DTEnums.ActionEnum.Edit.ToString(), logmodel, manager.user_name, manager.real_name);
                return("");
            }
            return(result);
        }
Ejemplo n.º 12
0
        private void TreeBind()
        {
            var manager    = context.dt_manager.FirstOrDefault(w => w.id == GetAdminInfo().id);
            var department = context.li_departments.FirstOrDefault(w => w.id == manager.department_id);

            BLL.department bll = new BLL.department();
            var            dt  = new DataTable();

            if (department == null)
            {
                dt = bll.GetList(0);
            }
            else if (department.parent_id == 0)
            {
                dt = bll.GetListByOkParentId(department.id, 0);
            }
            else
            {
                dt = bll.GetListByOkId(department.id, 0);
            }

            this.ddlDepartments.Items.Clear();
            this.ddlDepartments.Items.Add(new ListItem("不限", ""));
            foreach (DataRow dr in dt.Rows)
            {
                string Id         = dr["id"].ToString();
                int    ClassLayer = int.Parse(dr["class_layer"].ToString());
                string Title      = dr["department_name"].ToString().Trim();

                if (ClassLayer == 1)
                {
                    this.ddlDepartments.Items.Add(new ListItem(Title, Id));
                }
                else
                {
                    Title = "├ " + Title;
                    Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title;
                    this.ddlDepartments.Items.Add(new ListItem(Title, Id));
                }
                var g =
                    context.li_user_group_departments.Where(w => w.department_id == Convert.ToInt32(Id))
                    .Select(s => s.user_group_id)
                    .ToList();
                if (groupIdList.Count == 0)
                {
                    groupIdList = g;
                }
                else
                {
                    groupIdList = groupIdList.Concat(g).ToList();
                }

                departmentIdList.Add(int.Parse(Id));
            }
        }
Ejemplo n.º 13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     action  = DTRequest.GetQueryString("action");
     this.id = DTRequest.GetQueryInt("id");
     ChkAdminLevel("sys_department", action); //检查权限
     if (!string.IsNullOrEmpty(action) && action == DTEnums.ActionEnum.Edit.ToString())
     {
         this.action = DTEnums.ActionEnum.Edit.ToString();//修改类型
         if (this.id == 0)
         {
             JscriptMsg("传输参数不正确!", "back");
             return;
         }
         if (!new BLL.department().Exists(this.id))
         {
             JscriptMsg("导航不存在或已被删除!", "back");
             return;
         }
     }
     if (!Page.IsPostBack)
     {
         initData(1);
         ChkAdminLevel("sys_department", DTEnums.ActionEnum.View.ToString()); //检查权限
         if (action == DTEnums.ActionEnum.Edit.ToString())                    //修改
         {
             ShowInfo(this.id);
         }
         else
         {
             TreeBind();
             if (this.id > 0)
             {
                 this.ddlParentId.SelectedValue = this.id.ToString();
                 Model.department de = new BLL.department().GetModel(this.id);
                 if (de != null)
                 {
                     if (de.de_isGroup.Value)
                     {
                         initData(1); dlgroup.Visible = false;
                     }
                     else
                     {
                         initData(2);
                     }
                     string _treeText = string.Empty, _treeid = string.Empty;
                     new BLL.department().getDepartText(this.id, out _treeText, out _treeid, out string area);
                     labDepartText.Text = _treeText;
                 }
             }
         }
     }
 }
Ejemplo n.º 14
0
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     BLL.department bll = new BLL.department();
     if (IsshowNum)
     {
         this.rptList.DataSource = bll.getAllEmployee(area, txtPerson.Text.ToUpper(), IsshowNum, hasOrder);
         this.rptList.DataBind();
     }
     else
     {
         this.rptList1.DataSource = bll.getAllEmployee(area, txtPerson.Text.ToUpper());
         this.rptList1.DataBind();
     }
 }
Ejemplo n.º 15
0
 private void RptBind()
 {
     BLL.department bll = new BLL.department();
     if (IsshowNum)
     {
         this.rptList.DataSource = bll.getAllEmployee(area, "", IsshowNum, hasOrder);
         this.rptList.DataBind();
     }
     else
     {
         this.rptList1.DataSource = bll.getAllEmployee(area, "");
         this.rptList1.DataBind();
     }
 }
Ejemplo n.º 16
0
 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("sys_department", DTEnums.ActionEnum.Edit.ToString()); //检查权限
     BLL.department bll = new BLL.department();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         int sortId;
         if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
         {
             sortId = 99;
         }
         bll.UpdateSort(id, sortId);
     }
     JscriptMsg("保存排序成功!", Utils.CombUrlTxt("department_list.aspx", "", ""), "");
 }
Ejemplo n.º 17
0
        private void ShowInfo(int _id)
        {
            BLL.department   bll   = new BLL.department();
            Model.department model = bll.GetModel(_id);

            TreeBind();
            ddlParentId.SelectedValue = model.de_parentid.ToString();
            string _treeText = string.Empty, _treeid = string.Empty;

            bll.getDepartText(_id, out _treeText, out _treeid, out string area);
            labDepartText.Text = _treeText;
            initData();
            ddltype.SelectedValue = model.de_type.ToString();
            txtSortId.Text        = model.de_sort.ToString();
            txtTitle.Text         = model.de_name;
            txtSubTitle.Text      = model.de_subname;
            txtArea.Text          = model.de_area;
            isgroupDiv.Visible    = false;
            if (model.de_isGroup.Value)
            {
                labIsGroup.Text   = "是";
                cbIsGroup.Checked = true;
            }
            else
            {
                labIsGroup.Text   = "否";
                cbIsGroup.Checked = false;
            }
            if (model.de_isUse.Value)
            {
                cbIsUse.Checked = true;
            }
            else
            {
                cbIsUse.Checked = false;
            }
            if (model.de_type == 2 || model.de_type == 3)
            {
                dlsubtitle.Visible = false;
                dlarea.Visible     = false;
                dlgroup.Visible    = false;
            }
            txtSubTitle.Enabled = false;
            txtArea.Enabled     = false;
            ddlParentId.Enabled = false;
            ddltype.Enabled     = false;
        }
Ejemplo n.º 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            oID = DTRequest.GetString("oID");
            Model.Order order = new BLL.Order().GetModel(oID);
            if (order == null)
            {
                JscriptMsg("订单不存在!", "back");
                return;
            }
            if (order.o_lockStatus == 1)
            {
                PrintJscriptMsg("订单已锁定,不能再添加合作分成", "");
                return;
            }
            sdate = order.o_sdate.Value.ToString("yyyy-MM-dd");
            edate = order.o_edate.Value.ToString("yyyy-MM-dd");
            OrderPerson op    = order.personlist.Where(p => p.op_type == 1).ToArray()[0];
            string      place = ("," + order.o_place + ",").Replace("," + op.op_area + ",", ",");
            string      area  = "";

            if (!string.IsNullOrEmpty(place))
            {
                string[] plist = place.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                foreach (string item in plist)
                {
                    area    = new BLL.department().getAreaText(item);
                    trHtml += "<tr style=\"text-align: center;\" class=\"computeTR\">";
                    trHtml += "<td>" + area + "</td>";
                    trHtml += "<td>业绩分成(" + area + ")</td>";
                    trHtml += "<td><input type=\"text\" name=\"txtExpression1\" data-area=\"" + item + "\" style=\"width: 200px; \" class=\"input\" onblur=\"computeResult(this,1)\" /><span></span></td>";
                    trHtml += "<td><span class=\"computeInput1\">0</span></td>";
                    trHtml += "<td><input type=\"text\" name=\"txtExpression0\" data-area=\"" + item + "\" style=\"width: 200px; \" class=\"input\" onblur=\"computeResult(this,0)\" /><span></span></td>";
                    trHtml += "<td><span class=\"computeInput0\">0</span></td>";
                    trHtml += "</tr>";
                }
            }
            area    = new BLL.department().getAreaText(op.op_area);
            trHtml += "<tr style=\"text-align: center;\">";
            trHtml += "<td>" + area + "</td>";
            trHtml += "<td>业绩分成(" + area + ")</td>";
            trHtml += "<td><input type=\"text\" id=\"txtArea1\" name=\"txtExpression1\" data-area=\"" + op.op_area + "\"  disabled=\"disabled\" style=\"width: 200px; \" class=\"input\" value=\"0\" /><span></span></td>";
            trHtml += "<td>0</td>";
            trHtml += "<td><input type=\"text\" id=\"txtArea0\" name=\"txtExpression0\" data-area=\"" + op.op_area + "\" disabled=\"disabled\" style=\"width: 200px; \" class=\"input\" value=\"0\" /><span></span></td>";
            trHtml += "<td>0</td>";
            trHtml += "</tr>";
        }
Ejemplo n.º 19
0
 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("department_list", DTEnums.ActionEnum.Edit.ToString()); //检查权限
     BLL.department bll = new BLL.department();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         int sortId;
         if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
         {
             sortId = 99;
         }
         bll.UpdateField(id, "sort_id=" + sortId.ToString());
     }
     AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "保存部门排序"); //记录日志
     JscriptMsg("保存排序成功!", "department_list.aspx", "Success");
 }
Ejemplo n.º 20
0
 private string DoAdd()
 {
     try
     {
         Model.department model = new Model.department();
         BLL.department   bll   = new BLL.department();
         manager           = GetAdminInfo();
         model.de_type     = string.IsNullOrEmpty(ddltype.SelectedValue) ? (byte)0 : Utils.ObjToByte(ddltype.SelectedValue);
         model.de_parentid = int.Parse(ddlParentId.SelectedValue);
         model.de_isGroup  = cbIsGroup.Checked;
         model.de_name     = txtTitle.Text.Trim();
         model.de_subname  = txtSubTitle.Text.Trim();
         model.de_area     = txtArea.Text.Trim().ToUpper();
         model.de_sort     = Utils.ObjToInt(txtSortId.Text.Trim(), 0);
         model.de_isUse    = cbIsUse.Checked;
         return(bll.Add(model, manager.user_name, manager.real_name));
     }
     catch (Exception e)
     {
         return(e.Message);
     }
 }
Ejemplo n.º 21
0
        private bool DoEdit(int _id)
        {
            try
            {
                BLL.department   bll   = new BLL.department();
                Model.department model = bll.GetModel(_id);

                model.department_name = txtTitle.Text.Trim();
                model.sort_id         = int.Parse(txtSortId.Text.Trim());
                model.is_lock         = 0;
                if (cbIsLock.Checked == true)
                {
                    model.is_lock = 1;
                }
                model.remark = txtRemark.Text.Trim();
                if (model.is_sys == 0)
                {
                    int parentId = int.Parse(ddlParentId.SelectedValue);
                    //如果选择的父ID不是自己,则更改
                    if (parentId != model.id)
                    {
                        model.parent_id = parentId;
                    }
                }

                if (bll.Update(model))
                {
                    AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "修改部门信息:" + model.department_name); //记录日志
                    return(true);
                }
            }
            catch
            {
                return(false);
            }
            return(false);
        }
Ejemplo n.º 22
0
        private void ShowInfo(string _oid)
        {
            rptEmployee0.Visible = false;
            liemployee0.Visible  = false;
            BLL.Order bll = new BLL.Order();
            DataSet   ds  = bll.GetList(0, "o_id='" + _oid + "'", "o_addDate desc");

            if (ds == null || ds.Tables[0].Rows.Count == 0)
            {
                JscriptMsg("订单不存在!", "");
                return;
            }
            DataRow dr = ds.Tables[0].Rows[0];

            labOwner.Text   = new MettingSys.BLL.department().getAreaText(dr["op_area"].ToString()) + "," + dr["op_number"] + "," + dr["op_name"];
            txtCusName.Text = dr["c_name"].ToString();
            hCusId.Value    = dr["c_id"].ToString();
            List <Model.Contacts> contactlist = new BLL.Contacts().getList("co_cid=" + hCusId.Value + "", " co_flag desc,co_id asc");

            if (contactlist != null)
            {
                ddlcontact.DataSource     = contactlist;
                ddlcontact.DataTextField  = "co_name";
                ddlcontact.DataValueField = "co_id";
                ddlcontact.DataBind();
            }
            ddlcontact.SelectedValue       = dr["o_coid"].ToString();
            txtPhone.Text                  = dr["co_number"].ToString();
            ddlcontractPrice.SelectedValue = dr["o_contractPrice"].ToString();
            txtsDate.Text                  = ConvertHelper.toDate(dr["o_sdate"]).Value.ToString("yyyy-MM-dd");
            txteDate.Text                  = ConvertHelper.toDate(dr["o_edate"]).Value.ToString("yyyy-MM-dd");
            txtAddress.Text                = dr["o_address"].ToString();
            txtContent.Text                = dr["o_content"].ToString();
            txtContract.Text               = dr["o_contractContent"].ToString();
            txtRemark.Text                 = dr["o_remarks"].ToString();
            ddlfStatus.SelectedValue       = dr["o_status"].ToString();
            //ddldstatus.SelectedValue = dr["o_dstatus"].ToString();
            ddlpushStatus.SelectedValue = dr["o_isPush"].ToString();
            labFlag.Text          = Common.BusinessDict.checkStatus()[Utils.ObjToByte(dr["o_flag"])];
            ddlflag.SelectedValue = dr["o_flag"].ToString();
            labLockStatus.Text    = Common.BusinessDict.lockStatus()[Utils.ObjToByte(dr["o_lockStatus"])];
            labfinanceCost.Text   = dr["o_financeCust"].ToString();
            txtCost.Text          = dr["o_financeCust"].ToString();
            finCost = Utils.StrToDecimal(dr["o_financeCust"].ToString(), 0);
            ddllockstatus.SelectedValue = dr["o_lockStatus"].ToString();
            labFinRemarks.Text          = dr["o_finRemarks"].ToString();
            txtFinRemark.Text           = dr["o_finRemarks"].ToString();
            labStatusTime.Text          = Utils.ObjectToStr(dr["o_statusTime"]) == "" ? "" : Utils.StrToDateTime(Utils.ObjectToStr(dr["o_statusTime"])).ToString("yyyy-MM-dd HH:mm:ss");

            #region 归属地
            string placeStr = dr["o_place"].ToString();
            if (!string.IsNullOrEmpty(placeStr))
            {
                Dictionary <string, string> areaDic      = new BLL.department().getAreaDict();
                Dictionary <string, string> orderAreaDic = new Dictionary <string, string>();
                string[] list = placeStr.Split(',');
                foreach (string item in list)
                {
                    if (areaDic.ContainsKey(item))
                    {
                        orderAreaDic.Add(item, areaDic[item]);
                    }
                }
                rptAreaList.DataSource = orderAreaDic;
                rptAreaList.DataBind();
            }
            #endregion

            #region 人员
            DataTable pdt = bll.GetPersonList(0, "op_oid='" + _oid + "'", "op_id asc").Tables[0];
            if (pdt != null && pdt.Rows.Count > 0)
            {
                rptEmployee1.DataSource = pdt.Select("op_type=2");
                rptEmployee1.DataBind();

                rptEmployee2.DataSource = pdt.Select("op_type=3");
                rptEmployee2.DataBind();

                rptEmployee3.DataSource = pdt.Select("op_type=4");
                rptEmployee3.DataBind();

                rptEmployee4.DataSource = pdt.Select("op_type=5");
                rptEmployee4.DataBind();

                liplace.Visible          = false;
                liemployee1.Visible      = false;
                liemployee2.Visible      = false;
                liemployee3.Visible      = false;
                liemployee4.Visible      = false;
                uploadDiv.Visible        = false;
                uploadDiv2.Visible       = false;
                btnSave.Visible          = false;
                btnDstatus.Visible       = false;
                btnFlag.Visible          = false;
                btnLockstatus.Visible    = false;
                btnUpdateCost.Visible    = false;
                btnUnBusinessPay.Visible = false;
                btnReceiptPay.Visible    = false;
                btnFinRemark.Visible     = false;
                //btnPay.Visible = false;
                btnInvoince.Visible = false;
                //btnExcelIn.Visible = false;
                btnSharing.Visible = false;
                trFile.Visible     = false;
                #region 根据当前登录账户显示不同按钮
                DataRow[] drs1       = pdt.Select("op_type=1 and op_number='" + manager.user_name + "'"); //业务员
                DataRow[] drs2       = pdt.Select("op_type=2 and op_number='" + manager.user_name + "'"); //业务报账人员
                DataRow[] drs3       = pdt.Select("op_type=3 and op_number='" + manager.user_name + "'"); //业务策划人员
                DataRow[] drs4       = pdt.Select("op_type=4 and op_number='" + manager.user_name + "'"); //业务执行人员
                DataRow[] drs6       = pdt.Select("op_type=5 and op_number='" + manager.user_name + "'"); //业务设计人员
                bool      showDetail = false;

                if (drs4.Length > 0)
                {
                    isExecutiver             = true;
                    showDetail               = true;
                    uploadDiv.Visible        = true;
                    btnUnBusinessPay.Visible = true;
                    btnReceiptPay.Visible    = true;
                    //btnPay.Visible = true;
                    btnInvoince.Visible = true;
                    //btnExcelIn.Visible = true;
                }
                if (drs3.Length > 0 || drs6.Length > 0)
                {
                    showDetail         = true;
                    uploadDiv.Visible  = true;
                    uploadDiv2.Visible = true;
                    btnDstatus.Visible = true;
                    trFile.Visible     = true;
                    if (drs3.Length > 0)
                    {
                        ddldstatus.SelectedValue = drs3[0]["op_dstatus"].ToString();
                    }
                    else if (drs6.Length > 0)
                    {
                        ddldstatus.SelectedValue = drs6[0]["op_dstatus"].ToString();
                    }
                }
                if (drs2.Length > 0)
                {
                    isExecutiver             = false;
                    showDetail               = true;
                    liplace.Visible          = true;
                    liemployee2.Visible      = true;
                    liemployee3.Visible      = true;
                    liemployee4.Visible      = true;
                    uploadDiv.Visible        = true;
                    uploadDiv2.Visible       = true;
                    btnUnBusinessPay.Visible = true;
                    btnReceiptPay.Visible    = true;
                    btnSave.Visible          = true;
                    //btnPay.Visible = true;
                    btnInvoince.Visible = true;
                    //btnExcelIn.Visible = true;
                    trFile.Visible = true;
                }
                if (drs1.Length > 0)
                {
                    isExecutiver             = false;
                    showDetail               = true;
                    liplace.Visible          = true;
                    liemployee1.Visible      = true;
                    liemployee2.Visible      = true;
                    liemployee3.Visible      = true;
                    liemployee4.Visible      = true;
                    uploadDiv.Visible        = true;
                    uploadDiv2.Visible       = true;
                    btnSave.Visible          = true;
                    btnUnBusinessPay.Visible = true;
                    btnReceiptPay.Visible    = true;
                    //btnPay.Visible = true;
                    btnInvoince.Visible = true;
                    //btnExcelIn.Visible = true;
                    trFile.Visible = true;
                }
                DataRow[] drs5 = pdt.Select("op_type=1");
                //判断是否含有查看本区域数据的权限
                if (new BLL.permission().checkHasPermission(manager, "0602") && (drs5[0]["op_area"].ToString() == manager.area || Utils.ObjectToStr(dr["o_place"]).IndexOf(manager.area) > -1))
                {
                    showDetail     = true;
                    trFile.Visible = true;
                }
                string groupArea = new BLL.department().getGroupArea();//总部

                //判断是否是本区域,且含有财务基本权限
                if ((drs5[0]["op_area"].ToString() == manager.area || groupArea == manager.area) && new BLL.permission().checkHasPermission(manager, "0401"))
                {
                    showDetail               = true;
                    trFile.Visible           = true;
                    btnUnBusinessPay.Visible = true;
                    btnReceiptPay.Visible    = true;
                    uploadDiv2.Visible       = true;
                    //btnPay.Visible = true;
                    btnInvoince.Visible = true;
                    //btnExcelIn.Visible = true;
                }
                //判断是否含有查看本区域审批权限
                if (drs5[0]["op_area"].ToString() == manager.area && new BLL.permission().checkHasPermission(manager, "0603"))
                {
                    trFile.Visible  = true;
                    showDetail      = true;
                    btnFlag.Visible = true;
                }
                //
                if (groupArea == manager.area)
                {
                    if (new BLL.permission().checkHasPermission(manager, "0401"))
                    {
                        showDetail     = true;
                        trFile.Visible = true;
                    }
                    if (new BLL.permission().checkHasPermission(manager, "0405"))
                    {
                        showDetail            = true;
                        btnLockstatus.Visible = true;
                        btnUpdateCost.Visible = true;
                        trFile.Visible        = true;
                    }
                }
                if (new BLL.permission().checkHasPermission(manager, "0401"))
                {
                    btnFinRemark.Visible = true;
                    if (!Utils.StrToBool(dr["o_lockStatus"].ToString(), false))
                    {
                        btnSharing.Visible = true;
                    }
                }
                //以上都没有权限的,不能查看订单详细
                if (!showDetail)
                {
                    string msgbox = "parent.jsdialog(\"错误提示\", \"您没有管理该页面的权限,请勿非法进入!\", \"back\")";
                    Response.Write("<script type=\"text/javascript\">" + msgbox + "</script>");
                    Response.End();
                }
                #endregion
            }
            #endregion

            if (dr["o_lockStatus"].ToString() == "1")
            {
                liplace.Visible          = false;
                liemployee1.Visible      = false;
                liemployee2.Visible      = false;
                liemployee3.Visible      = false;
                liemployee4.Visible      = false;
                uploadDiv.Visible        = false;
                uploadDiv2.Visible       = false;
                btnSave.Visible          = false;
                btnDstatus.Visible       = false;
                btnFlag.Visible          = false;
                btnUpdateCost.Visible    = false;
                btnUnBusinessPay.Visible = false;
                btnReceiptPay.Visible    = false;
                //btnPay.Visible = false;
                btnInvoince.Visible = true;
                //btnExcelIn.Visible = false;
            }

            #region 活动文件
            DataTable fdt = bll.GetFileList(0, "f_oid='" + _oid + "'", "f_addDate asc,f_id asc").Tables[0];
            if (fdt != null && fdt.Rows.Count > 0)
            {
                rptAlbumList.DataSource = fdt.Select("f_type=1");
                rptAlbumList.DataBind();

                rptAlbumList2.DataSource = fdt.Select("f_type=2");
                rptAlbumList2.DataBind();
            }
            #endregion

            string sqlwhere = "";
            #region 执行备用金借款明细
            if (isExecutiver)
            {
                sqlwhere = " and uba_PersonNum='" + manager.user_name + "'";
            }
            DataSet unBusinessData = new BLL.unBusinessApply().GetList(0, "uba_oid='" + _oid + "' " + sqlwhere + "", "uba_addDate desc,uba_id desc");
            if (unBusinessData != null && unBusinessData.Tables[0].Rows.Count > 0)
            {
                rptunBusinessList.DataSource = unBusinessData;
                rptunBusinessList.DataBind();
            }
            #endregion

            #region 应收付
            DataTable natureData = new BLL.finance().getNature(_oid, isExecutiver ? manager.user_name : "");
            if (natureData != null && natureData.Rows.Count > 0)
            {
                rptNature.DataSource = natureData;
                rptNature.DataBind();
            }

            #endregion

            #region 发票
            if (isExecutiver)
            {
                sqlwhere = " and inv_personNum='" + manager.user_name + "'";
            }
            DataTable invoiceData = new BLL.invoices().GetList(0, "inv_oid='" + _oid + "' " + sqlwhere + "", "inv_addDate desc,inv_id desc").Tables[0];
            if (invoiceData != null && invoiceData.Rows.Count > 0)
            {
                foreach (DataRow inv in invoiceData.Rows)
                {
                    if (inv["inv_flag1"].ToString() != "1" && inv["inv_flag2"].ToString() != "1" && inv["inv_flag3"].ToString() != "1")
                    {
                        requestMoney += Utils.StrToDecimal(inv["inv_money"].ToString(), 0);
                    }
                    if (Utils.StrToBool(inv["inv_isConfirm"].ToString(), false))
                    {
                        confirmMoney += Utils.StrToDecimal(inv["inv_money"].ToString(), 0);
                    }
                }
                rptInvoiceList.DataSource = invoiceData;
                rptInvoiceList.DataBind();
            }
            #endregion

            #region 已收付款
            if (isExecutiver)
            {
                sqlwhere = " and rpd_personNum='" + manager.user_name + "'";
            }
            DataTable rpData = new BLL.ReceiptPayDetail().GetList(0, "rpd_oid='" + _oid + "'", "rpd_type desc,rpd_adddate desc,rpd_id desc").Tables[0];
            if (rpData != null && rpData.Rows.Count > 0)
            {
                rptList.DataSource = rpData;
                rptList.DataBind();
            }
            #endregion

            #region 结算汇总
            if (!isExecutiver)//执行人员不可查看
            {
                DataTable collectData = bll.getOrderCollect(_oid);
                if (collectData != null && collectData.Rows.Count > 0)
                {
                    foreach (DataRow inv in collectData.Rows)
                    {
                        finProfit += Utils.StrToDecimal(inv["profit"].ToString(), 0);
                        if (inv["fin_type"].ToString() == "True")
                        {
                            fin1 += Utils.StrToDecimal(inv["finMoney"].ToString(), 0);
                        }
                        else
                        {
                            fin0 += Utils.StrToDecimal(inv["finMoney"].ToString(), 0);
                        }
                    }

                    rptCollect.DataSource = collectData;
                    rptCollect.DataBind();
                }
            }
            #endregion
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.pageSize = GetPageSize(10); //每页数量
            _page         = DTRequest.GetString("page");
            _sMonth       = DTRequest.GetString("txtsDate");
            _eMonth       = DTRequest.GetString("txteDate");
            _status       = DTRequest.GetString("ddlstatus");
            _lockstatus   = DTRequest.GetString("ddllock");
            _area         = DTRequest.GetString("hide_place");
            _isRemove     = DTRequest.GetString("cbIsRemove");
            _isCust       = DTRequest.GetString("cbIsCust");
            action        = DTRequest.GetString("action");
            _excel        = DTRequest.GetString("Excel");
            ChkAdminLevel("sys_AreaAchievementStatistics", DTEnums.ActionEnum.View.ToString()); //检查权限
            if (!IsPostBack && _excel != "on" && string.IsNullOrEmpty(_page))
            {
                _sMonth     = DateTime.Now.ToString("yyyy-MM");
                _eMonth     = DateTime.Now.ToString("yyyy-MM");
                _status     = "3";
                _lockstatus = "1";
                _isCust     = "on";
                RptBind("1=1 " + CombSqlTxt(), "de_area");
            }
            InitData();
            if (action == "Search")
            {
                RptBind("1=1 " + CombSqlTxt(), "de_area");
            }
            if (_excel == "on")
            {
                Excel();
            }

            #region 绑定控件值
            txtsDate.Text           = _sMonth;
            txteDate.Text           = _eMonth;
            ddlstatus.SelectedValue = _status;
            ddllock.SelectedValue   = _lockstatus;
            cbIsCust.Checked        = _isCust == "on" ? true : false;
            cbIsRemove.Checked      = _isRemove == "on" ? true : false;
            string placeStr = _area;
            if (!string.IsNullOrEmpty(placeStr))
            {
                Dictionary <string, string> areaDic      = new BLL.department().getAreaDict();
                Dictionary <string, string> orderAreaDic = new Dictionary <string, string>();
                string[] list = placeStr.Split(',');
                foreach (string item in list)
                {
                    if (areaDic.ContainsKey(item))
                    {
                        orderAreaDic.Add(item, areaDic[item]);
                    }
                }
                rptAreaList.DataSource = orderAreaDic;
                rptAreaList.DataBind();
            }
            else
            {
                rptAreaList.DataSource = null;
                rptAreaList.DataBind();
            }
            #endregion
        }
Ejemplo n.º 24
0
 private void RptBind(string _strWhere, string _orderby)
 {
     BLL.department bll = new BLL.department();
     this.rptList.DataSource = bll.getAreaDict(); //bll.GetList(0, _strWhere, _orderby);
     this.rptList.DataBind();
 }
Ejemplo n.º 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ChkAdminLevel("sys_RevenueAnalysis", DTEnums.ActionEnum.View.ToString()); //检查权限
            this.pageSize = GetPageSize(10);                                          //每页数量
            _page         = DTRequest.GetString("page");
            _sMonth       = DTRequest.GetString("txtsDate");
            _eMonth       = DTRequest.GetString("txteDate");
            _cusName      = DTRequest.GetString("txtCusName");
            _cid          = DTRequest.GetString("hCusId");
            _area         = DTRequest.GetString("hide_place");
            _nature       = DTRequest.GetString("hide_nature");
            _person1      = DTRequest.GetString("hide_employee1");
            _person3      = DTRequest.GetString("hide_employee3");
            _group        = DTRequest.GetString("ddlGroup");
            _excel        = DTRequest.GetString("Excel");
            action        = DTRequest.GetString("action");
            _lockstatus   = DTRequest.GetString("ddllock");
            InitData();
            if (!IsPostBack && _excel != "on" && string.IsNullOrEmpty(_page))
            {
                InitData();
                _lockstatus = "1";
                _sMonth     = DateTime.Now.ToString("yyyy-MM");
                _eMonth     = DateTime.Now.ToString("yyyy-MM");
                RptBind();
            }
            if (action == "Search")
            {
                RptBind();
            }
            if (_excel == "on")
            {
                Excel();
            }

            #region 绑定控件值
            txtsDate.Text          = _sMonth;
            txteDate.Text          = _eMonth;
            txtCusName.Text        = _cusName;
            hCusId.Value           = _cid;
            ddlGroup.SelectedValue = _group;
            ddllock.SelectedValue  = _lockstatus;
            string placeStr = _area;
            if (!string.IsNullOrEmpty(placeStr))
            {
                Dictionary <string, string> areaDic      = new BLL.department().getAreaDict();
                Dictionary <string, string> orderAreaDic = new Dictionary <string, string>();
                string[] list = placeStr.Split(',');
                foreach (string item in list)
                {
                    if (areaDic.ContainsKey(item))
                    {
                        orderAreaDic.Add(item, areaDic[item]);
                    }
                }
                rptAreaList.DataSource = orderAreaDic;
                rptAreaList.DataBind();
            }
            else
            {
                rptAreaList.DataSource = null;
                rptAreaList.DataBind();
            }
            if (!string.IsNullOrEmpty(_nature))
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("na_id");
                dt.Columns.Add("na_name");
                string[] list = _nature.Split(',');
                foreach (string item in list)
                {
                    DataRow  dr  = dt.NewRow();
                    string[] lis = item.Split('|');
                    dr["na_id"]   = lis[0];
                    dr["na_name"] = lis[1];
                    dt.Rows.Add(dr);
                }
                rptNatureList.DataSource = dt;
                rptNatureList.DataBind();
            }
            else
            {
                rptNatureList.DataSource = null;
                rptNatureList.DataBind();
            }
            if (!string.IsNullOrEmpty(_person1))
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("op_name");
                dt.Columns.Add("op_number");
                dt.Columns.Add("op_area");
                string[] list = _person1.Split(',');
                foreach (string item in list)
                {
                    DataRow  dr  = dt.NewRow();
                    string[] lis = item.Split('|');
                    dr["op_name"]   = lis[0];
                    dr["op_number"] = lis[1];
                    dr["op_area"]   = lis[2];
                    dt.Rows.Add(dr);
                }
                rptEmployee1.DataSource = dt;
                rptEmployee1.DataBind();
            }
            else
            {
                rptEmployee1.DataSource = null;
                rptEmployee1.DataBind();
            }
            if (!string.IsNullOrEmpty(_person3))
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("op_name");
                dt.Columns.Add("op_number");
                dt.Columns.Add("op_area");
                string[] list = _person3.Split(',');
                foreach (string item in list)
                {
                    DataRow  dr  = dt.NewRow();
                    string[] lis = item.Split('|');
                    dr["op_name"]   = lis[0];
                    dr["op_number"] = lis[1];
                    dr["op_area"]   = lis[2];
                    dt.Rows.Add(dr);
                }
                rptEmployee3.DataSource = dt;
                rptEmployee3.DataBind();
            }
            else
            {
                rptEmployee3.DataSource = null;
                rptEmployee3.DataBind();
            }
            #endregion
        }
Ejemplo n.º 26
0
        private void RptBind()
        {
            //BLL.manager bll = new BLL.manager();
            //this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            //this.rptList.DataBind();

            IQueryable <dt_manager> query = context.dt_manager;

            BLL.department departmentbll = new BLL.department();

            if (string.IsNullOrWhiteSpace(ddlDepartments.SelectedValue)) // 不限:查自己的组权限 + 下属的组权限,都无选权限的话能看全部
            {
                var manager = context.dt_manager.Single(m => m.id == GetAdminInfo().id);
                if (manager.department_id > 0)
                {
                    query = query.Where(w => idstrList.Contains(w.id));
                }
            }
            else // 选了下属,看下属的组权限,无选的话不能看全部
            {
                var department = context.li_departments.FirstOrDefault(w => w.id == Convert.ToInt32(ddlDepartments.SelectedValue));
                if (department.class_layer == 1)
                {
                    DataTable dt = departmentbll.GetListByOkParentId(department.id, 0);
                    foreach (DataRow dr in dt.Rows)
                    {
                        string Id = dr["id"].ToString();
                        var    g  = context.dt_manager.Where(w => w.department_id == Convert.ToInt32(Id))
                                    .Select(s => s.id)
                                    .ToList();
                        if (manageridstrList.Count == 0)
                        {
                            manageridstrList = g;
                        }
                        else
                        {
                            manageridstrList = manageridstrList.Concat(g).ToList();
                        }
                    }
                    query = query.Where(w => manageridstrList.Contains(w.id)); // 不限:查自己的组权限 + 下属的组权限,都无选权限的话能看全部
                }
                else                                                           // 选了下属,看下属的组权限,无选的话不能看全部
                {
                    var canAccessGroups = context.dt_manager.Where(w => w.department_id == Convert.ToInt32(ddlDepartments.SelectedValue)).Select(s => s.id).ToArray();
                    query = query.Where(w => canAccessGroups.Contains(w.id));
                }
            }

            if (!string.IsNullOrWhiteSpace(txtKeywords.Text))
            {
                query = query.Where(w => (w.user_name.Contains(txtKeywords.Text) || w.real_name.Contains(txtKeywords.Text) || w.email.Contains(txtKeywords.Text)));
            }

            totalCount = query.Count();

            rptList.DataSource = query
                                 .OrderBy(u => u.add_time)
                                 .ThenByDescending(u => u.id)
                                 .Skip(pageSize * (page - 1))
                                 .Take(pageSize)
                                 .ToList();

            rptList.DataBind();

            //绑定页码
            txtPageNum.Text = pageSize.ToString();
            var pageUrl = Utils.CombUrlTxt("manager_list.aspx", "keywords={0}&page={1}&department_id={2}", txtKeywords.Text, "__id__", ddlDepartments.SelectedValue);

            PageContent.InnerHtml = Utils.OutPageList(pageSize, page, totalCount, pageUrl, 8);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public string Add(Model.manager model, Model.manager manager)
        {
            if (model.role_id == 0)
            {
                return("请选择用户角色");
            }
            if (string.IsNullOrEmpty(model.user_name))
            {
                return("用户名不能为空");
            }
            if (Exists(model.user_name))
            {
                return("用户名已经存在");
            }
            if (string.IsNullOrEmpty(model.password))
            {
                return("密码不能为空");
            }
            if (string.IsNullOrEmpty(model.real_name))
            {
                return("姓名不能为空");
            }
            if (string.IsNullOrEmpty(model.telephone))
            {
                return("电话不能为空");
            }
            if (model.departID == 0)
            {
                return("岗位不能为空");
            }
            Model.department de = new BLL.department().GetModel(model.departID);
            if (de == null)
            {
                return("岗位不存在");
            }
            if (de.de_type != 3)
            {
                return("请选择到岗位级别");
            }
            model.area      = de.de_area;
            model.user_name = model.user_name.ToUpper();
            model.area      = model.area.ToUpper();
            int    id     = 0;
            string result = dal.Add(model, out id);

            if (string.IsNullOrEmpty(result))
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("用户名:" + model.user_name + "<br/>");
                sb.Append("管理角色:" + model.role_id + "<br/>");
                sb.Append("姓名:" + model.real_name + "<br/>");
                sb.Append("邮箱:" + model.email + "<br/>");
                sb.Append("电话:" + model.telephone + "<br/>");
                sb.Append("岗位:" + model.departTree + "<br/>");
                sb.Append("区域:" + model.area + "<br/>");
                Model.business_log logmodel = new Model.business_log();
                logmodel.ol_relateID    = id;
                logmodel.ol_title       = "添加用户";
                logmodel.ol_content     = sb.ToString();
                logmodel.ol_operateDate = DateTime.Now;
                new business_log().Add(DTEnums.ActionEnum.Add.ToString(), logmodel, manager.user_name, manager.real_name);
                return("");
            }
            return(result);
        }
Ejemplo n.º 28
0
        private void RptBind()
        {
            Agp2pDataContext context = new Agp2pDataContext();

            BLL.department bll     = new BLL.department();
            var            options = new DataLoadOptions();

            options.LoadWith <dt_user_groups>(g => g.dt_users);
            options.LoadWith <dt_users>(u => u.li_wallets);
            context.LoadOptions = options;

            IQueryable <dt_user_groups> query = context.dt_user_groups;

            //if (string.IsNullOrWhiteSpace(ddlSubordinates.SelectedValue)) // 不限:查自己的组权限 + 下属的组权限,都无选权限的话能看全部
            //{
            //    var subordinatesId = context.dt_manager.Single(m => m.id == GetAdminInfo().id).dt_manager2.Select(s => s.id).ToArray();

            //    var canAccessGroups =
            //        context.li_user_group_access_keys.Where(
            //            k => k.owner_manager == GetAdminInfo().id || subordinatesId.Contains(k.owner_manager))
            //            .Select(k => k.user_group).Distinct()
            //            .ToArray();
            //    query = query.Where(w => !canAccessGroups.Any() || canAccessGroups.Contains(w.id));
            //}
            //else // 选了下属,看下属的组权限,无选的话不能看全部
            //{
            //    var canAccessGroups = context.li_user_group_access_keys.Where(k => k.owner_manager == Convert.ToInt32(ddlSubordinates.SelectedValue)).Select(k => k.user_group).ToArray();
            //    query = query.Where(w => canAccessGroups.Contains(w.id));
            //}

            if (string.IsNullOrWhiteSpace(ddlDepartments.SelectedValue)) // 不限:查自己的组权限 + 下属的组权限,都无选权限的话能看全部
            {
                var manager = context.dt_manager.Single(m => m.id == GetAdminInfo().id);
                if (manager.department_id > 0)
                {
                    query = query.Where(w => idstrList.Contains(w.id));
                }
            }
            else // 选了下属,看下属的组权限,无选的话不能看全部
            {
                var department = context.li_departments.FirstOrDefault(w => w.id == Convert.ToInt32(ddlDepartments.SelectedValue));
                if (department.class_layer == 1)
                {
                    DataTable dt = bll.GetListByOkParentId(department.id, 0);
                    foreach (DataRow dr in dt.Rows)
                    {
                        string Id = dr["id"].ToString();
                        var    g  = context.li_user_group_departments.Where(w => w.department_id == Convert.ToInt32(Id))
                                    .Select(s => s.user_group_id)
                                    .ToList();
                        if (departmentIdList.Count == 0)
                        {
                            departmentIdList = g;
                        }
                        else
                        {
                            departmentIdList = departmentIdList.Concat(g).ToList();
                        }
                    }
                    query = query.Where(w => departmentIdList.Contains(w.id)); // 不限:查自己的组权限 + 下属的组权限,都无选权限的话能看全部
                }
                else                                                           // 选了下属,看下属的组权限,无选的话不能看全部
                {
                    var canAccessGroups = context.li_user_group_departments.Where(w => w.department_id == Convert.ToInt32(ddlDepartments.SelectedValue)).Select(s => s.user_group_id).ToArray();
                    query = query.Where(w => canAccessGroups.Contains(w.id));
                }
            }
            query = query.Where(w => w.title.Contains(txtKeywords.Text));

            var groups = query.OrderBy(g => g.grade).AsEnumerable().Select(g => new GroupDetails
            {
                id              = g.id,
                is_default      = g.is_default,
                GroupName       = g.title,
                Servers         = QueryServers(g),
                UserCount       = QueryGroupUserCount(g),
                DepartmentName  = QueryDepartmentName(g),
                IdleMoney       = QueryGroupUserWalletSum(g, w => w.idle_money),
                LockedMoney     = QueryGroupUserWalletSum(g, w => w.locked_money),
                InvestingMoney  = QueryGroupUserWalletSum(g, w => w.investing_money),
                UnpaidPrincipal = QueryGroupUserWalletSum(g, w => w.total_investment - w.investing_money),
                TotalInvestment = QueryGroupUserWalletSum(g, w => w.total_investment),
                ProfitingMoney  = QueryGroupUserWalletSum(g, w => w.profiting_money),
                PaidMoney       = QueryGroupUserWalletSum(g, w => w.total_profit),
                TotalProfit     = QueryGroupUserWalletSum(g, w => w.total_profit + w.profiting_money),
                TotalCharge     = QueryGroupUserWalletSum(g, w => w.total_charge),
                TotalWithdraw   = QueryGroupUserWalletSum(g, w => w.total_withdraw)
            }).ToLazyList();

            rptList.DataSource = groups.Concat(Enumerable.Range(0, 1).Select(i => new GroupDetails
            {
                GroupName  = "总计",
                is_default = 1, // hide operation
                UserCount  = groups.Sum(g => g.UserCount),
                //DepartmentName = groups.Select(g => g.DepartmentName).ToString(),
                IdleMoney       = groups.Sum(w => w.IdleMoney),
                LockedMoney     = groups.Sum(w => w.LockedMoney),
                InvestingMoney  = groups.Sum(w => w.InvestingMoney),
                UnpaidPrincipal = groups.Sum(w => w.TotalInvestment - w.InvestingMoney),
                TotalInvestment = groups.Sum(w => w.TotalInvestment),
                ProfitingMoney  = groups.Sum(w => w.ProfitingMoney),
                PaidMoney       = groups.Sum(w => w.TotalProfit),
                TotalProfit     = groups.Sum(w => w.TotalProfit + w.ProfitingMoney),
                TotalCharge     = groups.Sum(w => w.TotalCharge),
                TotalWithdraw   = groups.Sum(w => w.TotalWithdraw)
            }));

            rptList.DataBind();
        }
Ejemplo n.º 29
0
 private void RptBind()
 {
     BLL.department bll = new BLL.department();
     this.rptList.DataSource = bll.GetList(0, "");
     this.rptList.DataBind();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.pageSize = GetPageSize(10); //每页数量
     _page         = DTRequest.GetString("page");
     _sMonth       = DTRequest.GetString("txtsDate");
     _eMonth       = DTRequest.GetString("txteDate");
     _status       = DTRequest.GetString("ddlstatus");
     _lockstatus   = DTRequest.GetString("ddllock");
     _area         = DTRequest.GetString("hide_place");
     _person       = DTRequest.GetString("hide_employee3");
     _isRemove     = DTRequest.GetString("cbIsRemove");
     _isCust       = DTRequest.GetString("cbIsCust");
     action        = DTRequest.GetString("action");
     _type         = DTRequest.GetString("ddltype");
     _excel        = DTRequest.GetString("Excel");
     if (_type == "")
     {
         _type = "0";
     }
     _self = DTRequest.GetString("self");
     if (_self == "1")//个人业绩
     {
         manager             = GetAdminInfo();
         _person             = manager.real_name + "|" + manager.user_name + "|" + manager.area;
         liemployee3.Visible = false;
     }
     else
     {
         ChkAdminLevel("sys_AchievementStatistics", DTEnums.ActionEnum.View.ToString()); //检查权限
     }
     if (!IsPostBack && _excel != "on" && string.IsNullOrEmpty(_page))
     {
         _sMonth     = DateTime.Now.ToString("yyyy-MM");
         _eMonth     = DateTime.Now.ToString("yyyy-MM");
         _status     = "3";
         _lockstatus = "1";
         _isCust     = "on";
         RptBind("1=1 " + CombSqlTxt(), _type == "0"?"p1.op_number asc": "p3.op_number asc");
     }
     InitData();
     if (action == "Search")
     {
         RptBind("1=1 " + CombSqlTxt(), _type == "0" ? "p1.op_number asc" : "p3.op_number asc");
     }
     if (_excel == "on")
     {
         Excel();
     }
     #region 绑定控件值
     txtsDate.Text           = _sMonth;
     txteDate.Text           = _eMonth;
     ddlstatus.SelectedValue = _status;
     ddllock.SelectedValue   = _lockstatus;
     ddltype.SelectedValue   = _type;
     cbIsCust.Checked        = _isCust == "on" ? true : false;
     cbIsRemove.Checked      = _isRemove == "on" ? true : false;
     string placeStr = _area;
     if (!string.IsNullOrEmpty(placeStr))
     {
         Dictionary <string, string> areaDic      = new BLL.department().getAreaDict();
         Dictionary <string, string> orderAreaDic = new Dictionary <string, string>();
         string[] list = placeStr.Split(',');
         foreach (string item in list)
         {
             if (areaDic.ContainsKey(item))
             {
                 orderAreaDic.Add(item, areaDic[item]);
             }
         }
         rptAreaList.DataSource = orderAreaDic;
         rptAreaList.DataBind();
     }
     else
     {
         rptAreaList.DataSource = null;
         rptAreaList.DataBind();
     }
     if (!string.IsNullOrEmpty(_person))
     {
         DataTable dt = new DataTable();
         dt.Columns.Add("op_name");
         dt.Columns.Add("op_number");
         dt.Columns.Add("op_area");
         string[] list = _person.Split(',');
         foreach (string item in list)
         {
             DataRow  dr  = dt.NewRow();
             string[] lis = item.Split('|');
             dr["op_name"]   = lis[0];
             dr["op_number"] = lis[1];
             dr["op_area"]   = lis[2];
             dt.Rows.Add(dr);
         }
         rptEmployee2.DataSource = dt;
         rptEmployee2.DataBind();
     }
     else
     {
         rptEmployee2.DataSource = null;
         rptEmployee2.DataBind();
     }
     #endregion
 }