public async Task <ErrorHandling> CreateCuenta(account_info account)
        {
            using (HttpClient client = new HttpClient())
            {
                var URL = "";
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                try
                {
                    var security = new
                    {
                        login    = "******",
                        password = "******"
                    };
                    var param = JsonConvert.SerializeObject(new { account_info = account });
                    URL = _Global.BaseUrlAdmin + _Global.Servicio.Account + "/" + _Global.Metodo.add_account + "/" + security.AsJson() + "/" + param;

                    var response = await client.GetAsync(URL);

                    var json = await response.Content.ReadAsStringAsync();

                    return(JsonConvert.DeserializeObject <ErrorHandling>(json));
                }
                catch (Exception ex)
                {
                    return(default(ErrorHandling));
                }
            }
        }
        //
        // GET: /TeacherSub/

        public ActionResult teacherAdd()
        {
            //前台接收的数据
            string teacherName = Request["teacherName"] == null ? "" : Request["teacherName"].ToString();
            string teacherNo   = Request["teacherNo"] == null ? "" : Request["teacherNo"].ToString();
            int    teacherSex  = Request["teacherSex"] == null ? 1 : int.Parse(Request["teacherSex"]);
            string teacherDep  = Request["teacherDep"] == null ? "" : Request["teacherDep"].ToString();
            //帐户密码
            string account  = Request["account"] == null ? "" : Request["account"].ToString();
            string password = Request["password"] == null ? "" : Request["password"].ToString();
            string _role    = Request["role"] == null?"-1":Request["role"].ToString();
            int    role     = -1;

            if (!int.TryParse(_role, out role))
            {
                role = -1;
            }
            account_info a = new account_info();

            a.account  = account;
            a.password = password;
            a.role     = role;

            Teacher t = new Teacher();

            t.teacherName = teacherName;
            t.teacherNo   = teacherNo;
            t.teacherSex  = teacherSex;
            t.teacherDep  = teacherDep;
            t.account     = account;

            MsgBox mb = new TeacherManager().teacherAdd(t, a);

            return(Json(mb));
        }
Esempio n. 3
0
        public MsgBox insertTeacher(Teacher t, account_info a)
        {
            MsgBox mb = new MsgBox();

            mb.status = false;

            if (string.IsNullOrEmpty(t.ID))
            {
                t.ID = Guid.NewGuid().ToString();
            }

            try
            {
                new Repository <Teacher>().Insert(t);
                new Repository <account_info>().Insert(a);
                mb.msg    = "保存成功!";
                mb.status = true;
            }
            catch (Exception e)
            {
                mb.status = false;
                mb.msg    = "保存失败。";
            }
            return(mb);
        }
Esempio n. 4
0
        public static account_info GetCurrentAccount()
        {
            account_info ai = new account_info();

            if (HttpContext.Current.Session["account"] != null)
            {
                ai = AccountHelper.GetAccountInfo(HttpContext.Current.Session["account"].ToString());
            }

            return(ai);
        }
Esempio n. 5
0
        public MsgBox studentAdd(Student s, account_info a)
        {
            //建立主键
            s.ID = Guid.NewGuid().ToString();
            a.ID = Guid.NewGuid().ToString();

            MsgBox mb = new MsgBox();

            if (!AccountHelper.isExist(a.account))
            {
                mb = new StudentDAO().insertStudent(s, a);
            }
            else
            {
                mb.status = false;
                mb.msg    = "账号不可用,请更换账号。";
            }
            return(mb);
        }
Esempio n. 6
0
        public static MsgBox changePassword(string account, string pwd)
        {
            MsgBox       mb = new MsgBox();
            account_info ai = AccountHelper.GetAccountInfo(account);

            ai.password = pwd;
            try
            {
                new Repository <account_info>().Update(ai);
                mb.status = true;
                mb.msg    = "密码修改成功。";
            }
            catch (Exception e)
            {
                mb.status = false;
                mb.msg    = e.Message;
            }
            return(mb);
        }
        //
        // GET: /StudentSub/

        public ActionResult studentAdd()
        {
            //前台接收的数据
            string studentName       = Request["studentName"] == null ? "" : Request["studentName"].ToString();
            string studentNo         = Request["studentNo"] == null ? "" : Request["studentNo"].ToString();
            int    studentSex        = Request["studentSex"] == null ? 1 : int.Parse(Request["studentSex"]);
            string studentSession    = Request["studentSession"] == null ? "" : Request["studentSession"].ToString();
            string studentProfession = Request["studentProfession"] == null ? "" : Request["studentProfession"].ToString();
            string studentClass      = Request["studentClass"] == null ? "" : Request["studentClass"].ToString();
            //帐户密码
            string account  = Request["account"] == null ? "" : Request["account"].ToString();
            string password = Request["password"] == null ? "" : Request["password"].ToString();
            string _role    = Request["role"] == null ? "-1" : Request["role"].ToString();
            int    role     = -1;

            if (!int.TryParse(_role, out role))
            {
                role = -1;
            }
            account_info a = new account_info();

            a.account  = account;
            a.password = password;
            a.role     = role;


            Student s = new Student();

            s.studentName       = studentName;
            s.studentNo         = studentNo;
            s.studentSex        = studentSex;
            s.studentSession    = studentSession;
            s.studentProfession = studentProfession;
            s.studentClass      = studentClass;
            s.account           = account;



            MsgBox mb = new StudentManager().studentAdd(s, a);

            return(Json(mb));
        }
        public account_info SetAccount(AccountEditar accountEditar)
        {
            var account = new account_info();
            var now     = DateTime.Now;

            var YY = now;
            var MM = now.Month.ToString();
            var DD = now.Day.ToString();

            if (MM.Length == 1)
            {
                MM = "0" + MM;
            }
            if (DD.Length == 1)
            {
                DD = "0" + DD;
            }

            var activationDate = now.Year + "-" + MM + "-" + DD;

            account.id              = "a" + accountEditar.Telefono;
            account.phone1          = accountEditar.Telefono;
            account.iso_4217        = "USD";
            account.i_customer      = 260271; //Online customers
            account.i_distributor   = 282645; //distributor  customers
            account.batch_name      = "260271-di-pinless";
            account.country         = "US";
            account.billing_model   = -1;
            account.control_number  = 1;
            account.h323_password   = ServicePassword;
            account.i_product       = 22791;
            account.activation_date = activationDate.Trim();
            account.firstname       = accountEditar.Nombre;
            account.lastname        = accountEditar.Apellido;

            account.balance  = 0;
            account.email    = accountEditar.Email;
            account.login    = accountEditar.Email;
            account.password = "******";
            return(account);
        }
Esempio n. 9
0
        public MsgBox teacherAdd(Teacher t, account_info a)
        {
            //建立主键
            t.ID = Guid.NewGuid().ToString();
            a.ID = Guid.NewGuid().ToString();
            MsgBox mb = new MsgBox();

            if (!AccountHelper.isExist(a.account))
            {
                mb = new TeacherDAO().insertTeacher(t, a);
            }
            else
            {
                mb.status = false;
                mb.msg    = "账号不可用,请更换账号。";
            }



            return(mb);
        }
Esempio n. 10
0
        public static string getMenu(string account)
        {
            account_info  ai = AccountHelper.GetAccountInfo(account);
            StringBuilder m  = new StringBuilder();

            if (!string.IsNullOrEmpty(ai.ID))
            {
                if (ai.role == -2 || ai.role == 1 || ai.role == 2 || ai.role == 3 || ai.role == 4)
                {
                    m.Append("<br/><a href='#' id='lessonsForLabs' onclick='LessonTable()'>实验室课表查询</a><hr/>");
                }
                if (ai.role == -2 || ai.role == 1 || ai.role == 2)
                {
                    m.Append("<br /><a href='#' id='labAdd' onclick='Lab()'>实验室管理</a><hr />");
                }
                if (ai.role == -2 || ai.role == 1 || ai.role == 2)
                {
                    m.Append("<br /><a href='#' id='lessonAdd' onclick='LessonAdd()'>实验室课程管理</a><hr />");
                }
                if (ai.role == -2 || ai.role == 1 || ai.role == 2 || ai.role == 3)
                {
                    m.Append("<br/><a href='#' id='labBook' onclick='labBook()'>预约实验室</a><hr/>");
                }
                if (ai.role == -2 || ai.role == 1)
                {
                    m.Append("<br/><a href='#'id='labBookApprove' onclick='labBookApprove()'>预约实验室审核</a><hr/>");
                }
                if (ai.role == -2 || ai.role == 1)
                {
                    m.Append("<br/><a href='#' id='lowValue' onclick='LowValue()'>低值耐用品登记</a><hr/>");
                }
                if (ai.role == -2 || ai.role == 1 || ai.role == 2)
                {
                    m.Append("<br/><a href='#' id='propertyTake' onclick='PropertyTake()'>实验室物品领用</a><hr/>");
                }
                if (ai.role == -2 || ai.role == 1 || ai.role == 2 || ai.role == 3 || ai.role == 4 || ai.role == 5)
                {
                    m.Append("<br/><a href='#' id='repair' onclick='Repair()'>实验室报修</a><hr/>");
                }
                if (ai.role == -2 || ai.role == 1 || ai.role == 2 || ai.role == 4)
                {
                    m.Append("<br /><a href='#' id='repairList' onclick='RepairList()'>实验室维修情况报告</a><hr />");
                }
                if (ai.role == -2)
                {
                    m.Append("<br /><a href='#' id='yearRepair' onclick='YearRepair()'>实验室维修绩效</a><hr />");
                }
                if (ai.role == -2)
                {
                    m.Append("<br /><a href='#' id='teacherAdd' onclick='TeacherAdd()'>教师账户管理</a><hr />");
                }
                if (ai.role == -2)
                {
                    m.Append("<br /><a href='#' id='studentAdd' onclick='StudentAdd()'>学生账户管理</a><hr />");
                }
                if (ai.role == -2 || ai.role == 1)
                {
                    m.Append("<br /><a href='#' id='propertyReg' onclick='PropertyReg()'>固定资产登记表</a><hr />");
                }
                m.Append("<br /><a href='#' id='changePassword' onclick='PasswordChange()'>修改密码</a><hr />");
            }
            else
            {
                m.Append("登陆账户出错。");
            }
            return(m.ToString());
        }