Beispiel #1
0
    protected void rpt_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        int entId = int.Parse(e.CommandArgument.ToString());

        if (e.CommandName.ToLower() == "addadmin")
        {
            DJ_TourEnterprise ent = bllDJEnt.GetDJS8id(entId.ToString())[0];
            if (string.IsNullOrEmpty(ent.SeoName))
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "accountcannotnull", "alert('该企业还没有seoname,请先填写seoname');", true);
                return;
            }
            if (bllMember.GetMember(ent.SeoName) != null)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "accountcannotnull", "alert('用户名重复,请检查seoname是否重复');", true);
                return;
            }
            string loginname = ent.SeoName;
            DJ_User_TourEnterprise djuserent = new DJ_User_TourEnterprise();
            djuserent.Enterprise = bllDJEnt.GetDJS8id(entId.ToString())[0];
            djuserent.Name = loginname;
            djuserent.PermissionType = PermissionType.报表查看员 | PermissionType.团队录入员 | PermissionType.信息编辑员 | PermissionType.用户管理员;
            djuserent.Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("123456", "MD5");
            bllMember.CreateUpdateMember(djuserent);
        }

        if (e.CommandName.ToLower() == "resetpwd")
        {
            DJ_TourEnterprise ent = bllDJEnt.GetDJS8id(entId.ToString())[0];
            bllMember.ResetEntAdmin(ent);
            ScriptManager.RegisterStartupScript(this, this.GetType(), "accountcannotnull", "alert('重置密码成功');", true);
        }
        BindList();
    }
Beispiel #2
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        if (txtName.Text == "" || cbList.SelectedItem == null)
        {
            ShowNotification("用户名或权限未填写");
            return;
        }
        DJ_User_TourEnterprise mgrUser = new DJ_User_TourEnterprise();
        if (Request.QueryString["userid"] != null)
        {
            mgrUser = blldj_user.GetByMemberId(Guid.Parse(Request.QueryString["userid"]));
        }
        else
        {
            mgrUser.Password = FormsAuthentication.HashPasswordForStoringInConfigFile("123456", "MD5");
        }
        mgrUser.Enterprise = Master.CurrentTE;
        mgrUser.Name = txtName.Text;
        Model.PermissionType sat = 0;
        int result, result2;
        for (int i = 0; i < cbList.Items.Count; i++)
        {
            if (cbList.Items[i].Selected)
            {
                Model.PermissionType permisson = new PermissionType();
                switch (i)
                {
                    case 0: permisson = Model.PermissionType.信息编辑员; sat = sat | permisson; break;
                    case 1: permisson = Model.PermissionType.报表查看员; break;
                    case 2: permisson = Model.PermissionType.用户管理员; break;
                    default:
                        break;
                }
                sat = sat | permisson;
            }
        }
        int.TryParse(mgrUser.PermissionType.ToString(), out result);
        int.TryParse(sat.ToString(), out result2);
        if (result == 7 && result2 != 7)
        {
            IList<DJ_User_TourEnterprise> Listuser = blldj_user.GetUser_TEbyId(Master.CurrentTE.Id, 7);
            if (Listuser != null && Listuser.Count <= 1)
            {
                ShowNotification("目前仅有这一个超级管理员,无法更改权限");
                return;
            }
        }
        mgrUser.PermissionType = sat;

        string message;
        blldj_user.SaveOrUpdate(mgrUser, out message);
        if (message != "")
        {
            ShowNotification(message);
        }
        else
            ShowNotification("提示", "保存成功", "/TourEnterprise/TEUserManager.aspx");
    }
Beispiel #3
0
 public IList<DJ_TourGroup> GetGroupsForDjsAdmin(DJ_User_TourEnterprise djsUser)
 {
     string editorName = djsUser.Name;
     if (djsUser.PermissionType ==( PermissionType.报表查看员 | PermissionType.团队录入员 | PermissionType.信息编辑员 | PermissionType.用户管理员))
     {
         editorName = string.Empty;
     }
     return GetGroupsForEditor(djsUser.Enterprise.Id, editorName);
 }
Beispiel #4
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        if (txtName.Text == "" || cbList.SelectedItem == null)
        {
            ShowNotification("用户名或权限未填写");
            return;
        }
        DJ_User_TourEnterprise mgrUser = new DJ_User_TourEnterprise();
        if (Request.QueryString["userid"] != null)
        {
            mgrUser = blldj_user.GetByMemberId(Guid.Parse(Request.QueryString["userid"]));
        }
        else
        {
            mgrUser.Password=FormsAuthentication.HashPasswordForStoringInConfigFile("123456", "MD5");
        }
        mgrUser.Enterprise = Master.CurrentDJS;
        mgrUser.Name = txtName.Text;
        Model.PermissionType sat = 0;
        int result, result2;
        foreach (ListItem item in cbList.Items)
        {
            if (item.Selected)
            {
                Model.PermissionType permisson = (Model.PermissionType)Enum.Parse(typeof(Model.PermissionType), item.Text.Substring(0,item.Text.IndexOf('(')));
                sat = sat | permisson;
            }
        }
        int.TryParse(mgrUser.PermissionType.ToString(), out result);
        int.TryParse(sat.ToString(), out result2);
        if (result == 15&&result2!=15)
        {
            IList<DJ_User_TourEnterprise> Listuser = blldj_user.GetUser_TEbyId(CurrentDJS.Id, 15);
            if (Listuser != null && Listuser.Count <= 1)
            {
                ShowNotification("目前仅有这一个超级管理员,无法更改权限");
                return;
            }
        }
        mgrUser.PermissionType = sat;

        string message;
        blldj_user.SaveOrUpdate(mgrUser,out message);
        if (message != "")
        {
            ShowNotification(message);
        }
        else
            ShowNotification("提示", "保存成功", "/LocalTravelAgent/LTAUserManager.aspx");
    }
Beispiel #5
0
    protected void btnInitial_Click(object sender, EventArgs e)
    {
        ExcelOplib.ExcelDjsOpr djsopr = new ExcelOplib.ExcelDjsOpr();
        IList<ExcelOplib.Entity.DJSEntity> enlist = djsopr.getDJSlist();
        IList<Enter_excel> templist = new List<Enter_excel>();

        //初始化管理部门
        IList<Model.DJ_GovManageDepartment> govDic = new List<Model.DJ_GovManageDepartment>();
        foreach (var item in enlist.Where(x => x.EnterpType == 数据类型.管理部门))
        {
            govDic.Add(new Model.DJ_GovManageDepartment()
            {
                Name = item.Department1,
                Area = bllarea.GetAreaByAreaname(item.Diqu),
                seoname = item.Seoname
            });
        }
        foreach (var item in govDic)
        {
            if (bllgov.GetGovDptByName(item.Name).Count == 0)
            {
                bllgov.Save(item);
            }
            Model.DJ_User_Gov user_gov = new Model.DJ_User_Gov();
            if (blldjuser.GetGov_UserByName(item.seoname) == null)
            {
                user_gov.Name = item.seoname;
                user_gov.Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("123456", "MD5"); ;
                user_gov.GovDpt = bllgov.GetGovDptByName(item.Name)[0];
                user_gov.PermissionType = Model.PermissionType.报表查看员
                    | Model.PermissionType.信息编辑员 | Model.PermissionType.用户管理员;
                /*此处需要修改*/
                //blldjuser.SaveOrUpdate(user_gov);
            }
        }

        //初始化地接社,景区,宾馆
        foreach (var item in enlist)
        {
            if (!string.IsNullOrEmpty(item.Department3))
            {
                string[] results = item.Department3.Split(new string[] { ",", "," }, StringSplitOptions.RemoveEmptyEntries);
                foreach (var item2 in results)
                {
                    templist.Add(new Enter_excel()
                    {
                        name = item2,
                        area = item.Diqu,
                        type = item.EnterpType.ToString(),
                        seoname = item.Seoname
                    });
                }
            }
        }

        foreach (var item in templist)
        {
            var area = bllarea.GetAreaByAreaname(item.area);
            #region MyRegion
            switch (item.type)
            {
                case "地接社":
                    var temp_djs = blldjs.GetDJS8Muti(0, Model.EnterpriseType.旅行社.ToString(), null, item.name);
                    if (temp_djs.Count == 0)
                    {
                        blldjs.AddDjs(item.name, string.Empty, area, "", "", "", "", "", item.seoname);
                    }
                    break;
                case "景区":
                    var temp_scenic = blldjs.GetDJS8Muti(0, Model.EnterpriseType.景点.ToString(), null, item.name);
                    if (temp_scenic.Count == 0)
                    {
                        bllscenic.Save(new Model.Scenic()
                        {
                            Name = item.name,
                            Area = area,
                            SeoName = item.seoname,
                            Type = Model.EnterpriseType.景点
                        });
                    }
                    break;
                case "宾馆":
                    var temp_hotel = blldjs.GetDJS8Muti(0, Model.EnterpriseType.宾馆.ToString(), null, item.name);
                    if (temp_hotel.Count == 0)
                    {
                        blldjs.Save(new Model.DJ_TourEnterprise()
                        {
                            Name = item.name,
                            Area = area,
                            SeoName = item.seoname,
                            Type = Model.EnterpriseType.宾馆
                        });
                    }
                    break;
            }
            #endregion
            var mem = bllmem.GetMember(item.seoname);
            if (mem != null)
            {
                var memEnterp = (Model.DJ_User_TourEnterprise)mem;
                memEnterp.Enterprise = blldjs.GetDJS8name(item.name).First();
                bllmem.CreateUpdateMember(memEnterp);
            }
            else
            {
                var membership=new Model.DJ_User_TourEnterprise()
                {
                    Enterprise = blldjs.GetDJS8name(item.name).First(),
                    Name = item.seoname,
                    PermissionType = PermissionType.报表查看员 | PermissionType.团队录入员 | PermissionType.信息编辑员 | PermissionType.用户管理员,
                    Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("123456", "MD5")
                };
                bllmem.CreateUpdateMember(membership);
                //如果是景区再添加一个scenicadmin
                if (item.type == "景区")
                {
                    bllscenicadmin.SaveOrUpdate(new ScenicAdmin() {
                        RealName=item.name,
                        Scenic=bllscenic.GetScenicByScenicName(item.name,null,0,null).FirstOrDefault(),
                        Membership=membership,
                        AdminType = Model.ScenicAdminType.检票员 | Model.ScenicAdminType.景区财务 | Model.ScenicAdminType.景区资料员,
                        IsDisabled=false
                    });
                }
            }
        }
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('初始化成功!')", true);
    }
Beispiel #6
0
        public bool UpdateForm(DJ_TourGroup CurrentGroup,string groupName,string beginDate,
            string daysAmount, DJ_DijiesheInfo CurrentDJS, DJ_User_TourEnterprise CurrentMember,IList<string> workerIds, out string errMsg)
        {
            errMsg = string.Empty;
            CurrentGroup.Name = groupName;
            CurrentGroup.BeginDate = Convert.ToDateTime(beginDate);
            if (CurrentGroup.BeginDate.DayOfYear < DateTime.Now.DayOfYear)
            {
                errMsg = "开始时间不能小于当天时间";
                return false;
            }
            int iDayAmount=Convert.ToInt32(daysAmount);
            //if (CurrentGroup.DaysAmount>iDayAmount)
            //{
            //    errMsg = string.Format("操作无法完成:当前输入的天数({1})小于已录入行程的天数({0}).为保证数据安全,输入天数应该大于等于已录入行程天数.请修改数字,或者在行程编辑页面删除部分行程.", CurrentGroup.DaysAmount, iDayAmount);
            //    return false;
            //}
            //for (int i = 0; i < iDayAmount; i++)
            //{

            //    DJ_Route r = new DJ_Route();
            //    r.DayNo = i + 1;
            //    r.DJ_TourGroup = CurrentGroup;
            //    CurrentGroup.Routes.Add(r);
            //}

            CurrentGroup.DaysAmount = iDayAmount;
            CurrentGroup.EndDate = CurrentGroup.BeginDate.AddDays(CurrentGroup.DaysAmount - 1);
            CurrentGroup.DJ_DijiesheInfo = CurrentDJS;
            CurrentGroup.DijiesheEditor = (DJ_User_TourEnterprise)CurrentMember;
            ///司机和导游
            bool hasSelectGuide = false;
            bool hasSelectDriver = false;
            bllGroupWorker.DeleteFromGroup(CurrentGroup);
            IList<DJ_Workers> workers = new List<DJ_Workers>();
            foreach(string workerId in workerIds)
            {

                    Model.DJ_Group_Worker gw = new DJ_Group_Worker();
                    hasSelectGuide = true;
                    DJ_Workers worker = bllWorker.GetOne(new Guid(workerId));
                    if (worker.WorkerType == DJ_GroupWorkerType.司机) { hasSelectDriver = true; }
                    if (worker.WorkerType == DJ_GroupWorkerType.导游) { hasSelectGuide = true; }
                    gw.DJ_Workers = worker;
                    gw.DJ_TourGroup = CurrentGroup;

                    gw.RD_WorkerName = worker.Name;
                    gw.RD_WorkerIdCard = worker.IDCard;
                    gw.RD_Phone = worker.Phone;

                    bllGroupWorker.Save(gw);
            }

            if (!hasSelectGuide)
            {
                errMsg = "必须指定导游";

                return false;
            }
            if (!hasSelectDriver)
            {
                errMsg = "必须指定司机";

                return false;
            }
            //路线信息

            return true;
        }