コード例 #1
0
ファイル: StaffHanding.cs プロジェクト: liguifa/ThreeTimes
        public List <object> ResetPassword(string datas)
        {
            string[]      data   = datas.Split(',');
            List <object> result = new List <object>();

            try
            {
                foreach (string str in data)
                {
                    long  id = Convert.ToInt64(str);
                    Staff S  = new Staff();
                    staff s  = S.Search(d => d.staff_Id == id && d.staff_IsDel == false)[0];
                    s.staff_Password = Md5.GetMd5Word("123456");
                    S.Modify(s, "staff_Password");
                }
                result.Add(1);
                result.Add("修改成功!");
            }
            catch
            {
                result.Add(0);
                result.Add("修改失败!未知错误....");
            }
            return(result);
        }
コード例 #2
0
ファイル: StaffHanding.cs プロジェクト: liguifa/ThreeTimes
        public List <object> ModifyPassword(long id, string name, string email, string pwd)
        {
            List <object> reslut = new List <object>();
            Staff         S      = new Staff();
            staff         s      = S.Search(d => d.staff_Id == id && d.staff_IsDel == false)[0];

            if (s.staff_TrueName == name && s.staff_Email == email)
            {
                if (pwd != "123456")
                {
                    if (!String.IsNullOrEmpty(pwd) && CheckDataOperation.CheckData(pwd, @"^[A-Za-z0-9]{0,25}$"))
                    {
                        s.staff_Password = Md5.GetMd5Word(pwd);
                        S.Modify(s, "staff_Password");
                        reslut.Add(1);
                    }
                    else
                    {
                        reslut.Add(0);
                        reslut.Add("密码格式错误!请输入小于25个非空字母或数字.....");
                    }
                }
                else
                {
                    reslut.Add(0);
                    reslut.Add("密码错误!请输入非原始密码.....");
                }
            }
            else
            {
                reslut.Add(0);
                reslut.Add("信息错误!请核对你的信息.....");
            }
            return(reslut);
        }
コード例 #3
0
ファイル: StaffHanding.cs プロジェクト: liguifa/ThreeTimes
        public List <object> ModifyDivisional(string id, string OwnId, string name, string changeName)
        {
            List <object> result = new List <object>();

            if (!String.IsNullOrEmpty(name) && name.Length <= 25)
            {
                Staff        S      = new Staff();
                List <staff> staffs = S.Search(d => d.company.company_Id == OwnId && d.staff_Department == changeName && d.staff_IsDel == false);
                if (staffs.Count != 0)
                {
                    foreach (staff s in staffs)
                    {
                        s.staff_Department = name;
                        S.Modify(s, "staff_Department");
                    }
                    result.Add(1);
                    result.Add("更改成功!");
                }
                else
                {
                    result.Add(0);
                    result.Add("更改失败!部门数据错误......");
                }
            }
            else
            {
                result.Add(0);
                result.Add("更改失败!数据不合法.....");
            }
            return(result);
        }
コード例 #4
0
ファイル: StaffHanding.cs プロジェクト: liguifa/ThreeTimes
        public void RecordAnswers(long id, string datas)
        {
            Staff S = new Staff();
            staff s = S.Search(d => d.staff_Id == id && d.staff_IsDel == false)[0];

            s.staff_Spare = datas;
            S.Modify(s, "staff_Spare");
        }
コード例 #5
0
ファイル: Companyhandling.cs プロジェクト: liguifa/ThreeTimes
        public List <object> RemoveCompany(string id, string owecompanyid)
        {
            List <object> result = new List <object>();

            if (new Companyhandling().GetCompnayStatus(id) != 1)
            {
                if (base.SearchCount(d => d.company_Id == id && d.company_IsDel == false) != 0)
                {
                    List <company> list = base.Search(d => d.company_IsDel == false && (d.company_Id == id || d.company_OwnerCompany == id));
                    foreach (company com in list)
                    {
                        if (com.company_Id == id)
                        {
                            if (base.SearchCount(d => d.company_OwnerCompany == com.company_OwnerCompany && d.company_IsDel == false) == 1 && base.SearchCount(d => d.company_Id == com.company_OwnerCompany && d.company_IsDel == false) != 0)
                            {
                                company c = base.Search(d => d.company_Id == com.company_OwnerCompany && d.company_IsDel == false)[0];
                                c.company_IsSonIn = false;
                                base.Modify(c, "company_IsSonIn");
                            }
                        }
                        com.company_IsDel   = true;
                        com.company_IsSonIn = false;
                        base.Modify(com, new string[] { "company_IsDel", "company_IsSonIn" });
                        Staff        S  = new Staff();
                        List <staff> sf = S.Search(d => d.staff_IsDel == false && d.staff_OwnCompanyId == com.company_Id);
                        foreach (staff s in sf)
                        {
                            s.staff_IsDel = true;
                            S.Modify(s, "staff_IsDel");
                            Key        K = new Key();
                            List <key> k = K.Search(d => d.key_StaffId == s.staff_Id && d.key_IsDel == false);
                            foreach (key ky in k)
                            {
                                ky.key_IsDel = true;
                                K.Modify(ky, "key_IsDel");
                            }
                        }
                    }
                    result.Add(1);
                    result.Add("删除成功!");
                }
                else
                {
                    result.Add(0);
                    result.Add("删除失败!公司不存在.....");
                }
            }
            else
            {
                result.Add(0);
                result.Add("公司正在调查中,不能删除!");
            }
            return(result);
        }
コード例 #6
0
ファイル: StaffHanding.cs プロジェクト: liguifa/ThreeTimes
        public List <object> RemoveDivisional(string id, string OwnId, string remove)
        {
            List <object> result = new List <object>();

            if (new Companyhandling().GetCompnayStatus(id) != 1)
            {
                Staff        S      = new Staff();
                List <staff> staffs = S.Search(d => d.company.company_Id == OwnId && d.staff_Department == remove && d.staff_IsDel == false);
                if (staffs.Count != 0)
                {
                    Key K = new Key();
                    try
                    {
                        foreach (staff s in staffs)
                        {
                            s.staff_IsDel = true;
                            S.Modify(s, "staff_IsDel");
                            List <key> keys = K.Search(d => d.key_StaffId == s.staff_Id);
                            foreach (key k in keys)
                            {
                                k.key_IsDel = true;
                                K.Modify(k, "key_IsDel");
                            }
                        }
                        result.Add(1);
                        result.Add("删除成功!");
                    }
                    catch
                    {
                        result.Add(0);
                        result.Add("删除失败!未知错误.....");
                    }
                }
                else
                {
                    result.Add(0);
                    result.Add("删除失败!数据错误......");
                }
            }
            else
            {
                result.Add(0);
                result.Add("删除失败!公司正在进行调查无法删除......");
            }
            return(result);
        }
コード例 #7
0
        public List <object> SubmitKey(string datas, long id, long testInfoId)
        {
            List <object> result = new List <object>();

            try
            {
                string[] data = datas.Substring(0, datas.Length - 1).Split(',');
                string[] qId  = new string[data.Length];
                string[] keys = new string[data.Length];
                for (int i = 0; i < data.Length; i++)
                {
                    qId[i]  = data[i].Split('=')[0];
                    keys[i] = data[i].Split('=')[1];
                }
                for (int i = 0; i <= data.Length; i++)
                {
                    for (int k = i + 1; k < data.Length; k++)
                    {
                        if (Convert.ToInt32(qId[i]) > Convert.ToInt32(qId[k]))
                        {
                            string nark = qId[i];
                            qId[i] = qId[k];
                            qId[k] = nark;
                            string temp = keys[i];
                            keys[i] = keys[k];
                            keys[k] = temp;
                        }
                    }
                }
                key  ky     = new key();
                Type myData = typeof(key);

                for (int i = 0; i < data.Length; i++)
                {
                    string value = "key_key" + (i + 1);
                    foreach (PropertyInfo info in myData.GetProperties())
                    {
                        if (info.Name == value)
                        {
                            info.SetValue(ky, keys[i]);
                        }
                    }
                }
                ky.key_StaffId    = id;
                ky.key_TestInfoId = testInfoId;
                ky.key_IsDel      = false;
                base.Add(ky);
                Staff sf = new Staff();
                staff s  = sf.Search(d => d.staff_Id == id && d.staff_IsDel == false)[0];
                s.staff_IsWrite = true;
                sf.Modify(s, "staff_IsWrite");
                result.Add(1);
                result.Add("提交成功!谢谢参与");
            }
            catch
            {
                result.Add(0);
                result.Add("提交失败!系统未知错误.....");
            }
            return(result);
        }