Пример #1
0
        public static int insert( )
        {
            int    message;
            string js = wrapper.wrap(json) + "";
            List <Dictionary <string, object> > data = rqh.postDataByRequest(buildURL.creatUrl("student_add"), js);

            if (data.Count > 0)
            {
                photo = new Dictionary <string, Image>();
                foreach (Dictionary <string, object> i in data)
                {
                    dt.Rows.Add(i["studentid"].ToString(), i["name"].ToString(),
                                (i["sex"] != null) ? i["sex"].ToString() : "",
                                (i["dateofbirth"] != null) ? i["dateofbirth"].ToString() : "",
                                (i["phone"] != null) ? i["phone"].ToString() : "",
                                (i["email"] != null) ? i["email"].ToString() : "",
                                i["Address"] != null ? i["Address"].ToString() : "",
                                i["photo"] == null ? Properties.Resources.noimage : ci.getimage(i["photo"].ToString()),
                                (i["creatdate"] != null) ? i["creatdate"].ToString() : "",
                                i["staffname"] != null ? i["staffname"].ToString() : "");
                    photo.Add(i["photo"].ToString(), ci.getimage(i["photo"].ToString()));
                }
                var UniqueRows = dt.AsEnumerable().Distinct(DataRowComparer.Default);
                bp      = UniqueRows.CopyToDataTable();
                dt      = bp;
                message = 1;
            }
            else
            {
                message = 0;
            }
            return(message);
        }
Пример #2
0
        public static int checklogin(Object[] json)
        {
            int message;

            string js = wrapper.wrap(json) + "";
            List <Dictionary <string, object> > data = rqh.postDataByRequest(buildURL.creatUrl("login"), js);

            if (data.Count > 0)
            {
                foreach (Dictionary <string, object> itm in data)
                {
                    //new User((int)itm["userid"], itm["username"].ToString(), itm["password"].ToString(), itm["is_Active"].ToString(), itm["staffname"].ToString(),itm["rolename"].ToString());
                    us.Id        = int.Parse(itm["userid"] + "");
                    us.Username  = itm["username"].ToString();
                    us.Password  = itm["password"].ToString();
                    us.Is_active = itm["is_Active"].ToString();
                    us.Staffname = itm["staffname"].ToString();
                    us.Roleid    = itm["rolename"].ToString();
                }
                message = 1;
            }
            else
            {
                message = 0;
            }


            return(message);
        }