void AddRow(JsonObject tmpJsonObject, string IdProperty, DataTable tmpDataTable, ref JsonArray NewRecs)
        {
            DataRow
                tmpDataRow = tmpDataTable.NewRow();

            JsonObject
                NewRec = new JsonObject();

            string
                NewRecordIdProperty = "newRecord" + IdProperty;

            NewRec.Accumulate(NewRecordIdProperty, tmpJsonObject[NewRecordIdProperty]);
            NewRec.Accumulate("Id", tmpDataRow[IdProperty]);

            foreach (string Name in tmpJsonObject.Names)
            {
                if (Name == IdProperty ||
                    Name == NewRecordIdProperty ||
                    !tmpDataTable.Columns.Contains(Name))
                {
                    continue;
                }

                tmpDataRow[Name] = Name == "Name" ? "aaa (from AddRow)" : tmpJsonObject[Name];
                NewRec.Accumulate(Name, tmpDataRow[Name]);
            }

            tmpDataTable.Rows.Add(tmpDataRow);

            NewRecs.Add(NewRec);
        }
Exemple #2
0
 public void UpdateUserDomain(FormCollection collection)
 {
     if (!HttpContext.User.Identity.IsAuthenticated || CurrentUser == null)
     {
         RedirectToAction(ViewBag.BasePath + "Account/Login");//去登录
     }
     else
     {
         JsonObject json = new JsonObject();
         Model.Members.UsersExpModel model = bllUE.GetUsersModel(CurrentUser.UserID);
         if (null == model)
         {
             RedirectToAction(ViewBag.BasePath + "Account/Login");//去登录
         }
         else
         {
             model.HomePage = collection["Domain"];
             if (bllUE.Update(model))
             {
                 json.Accumulate("STATUS", "SUCC");
             }
             else
             {
                 json.Accumulate("STATUS", "FAIL");
             }
             Response.Write(json.ToString());
         }
     }
 }
Exemple #3
0
 public void ExistsNickName(FormCollection collection)
 {
     if (!HttpContext.User.Identity.IsAuthenticated || CurrentUser == null)
     {
         RedirectToAction(ViewBag.BasePath + "Account/Login");//去登录
     }
     else
     {
         JsonObject json     = new JsonObject();
         string     nickname = collection["NickName"];
         if (!string.IsNullOrWhiteSpace(nickname))
         {
             BLL.Members.Users bll = new BLL.Members.Users();
             if (bll.ExistsNickName(nickname))
             {
                 json.Accumulate("STATUS", "EXISTS");
             }
             else
             {
                 json.Accumulate("STATUS", "NOTEXISTS");
             }
         }
         else
         {
             json.Accumulate("STATUS", "NOTNULL");
         }
         Response.Write(json.ToString());
     }
 }
Exemple #4
0
 public void CheckPassword(FormCollection collection)
 {
     if (!HttpContext.User.Identity.IsAuthenticated || CurrentUser == null)
     {
         RedirectToAction(ViewBag.BasePath + "Account/Login");//去登录
     }
     else
     {
         JsonObject json     = new JsonObject();
         string     password = collection["Password"];
         if (!string.IsNullOrWhiteSpace(password))
         {
             SiteIdentity SID = new SiteIdentity(CurrentUser.UserName);
             if (SID.TestPassword(password.Trim()) == 0)
             {
                 json.Accumulate("STATUS", "ERROR");
             }
             else
             {
                 json.Accumulate("STATUS", "OK");
             }
         }
         else
         {
             json.Accumulate("STATUS", "UNDEFINED");
         }
         Response.Write(json.ToString());
     }
 }
        JsonObject DataTableToJson(DataTable tmpDataTable)
        {
            JsonObject
                RootJsonObject = new JsonObject();

            JsonArray
                tmpJsonArray = new JsonArray();

            DataRow
                tmpDataRow;

            for (int i = 0; i < tmpDataTable.Rows.Count; ++i)
            {
                tmpDataRow = tmpDataTable.Rows[i];

                JsonObject
                    tmpJsonObject = new JsonObject();

                foreach (DataColumn c in tmpDataTable.Columns)
                {
                    tmpJsonObject.Accumulate(c.ColumnName, !tmpDataRow.IsNull(c.ColumnName) ? tmpDataRow[c.ColumnName] : null);
                }

                tmpJsonArray.Add(tmpJsonObject);
            }

            RootJsonObject.Accumulate("success", true);
            RootJsonObject.Accumulate("count", tmpDataTable.Rows.Count);
            RootJsonObject.Accumulate("rows", tmpJsonArray);

            return(RootJsonObject);
        }
Exemple #6
0
        public void CancelAttention(FormCollection collection)
        {
            if (!HttpContext.User.Identity.IsAuthenticated || CurrentUser == null)
            {
                RedirectToAction("Login");//去登录
                return;
            }
            JsonObject json          = new JsonObject();
            string     passiveuserid = collection["PassiveUserID"];

            if (!string.IsNullOrWhiteSpace(passiveuserid))
            {
                if (PageValidate.IsNumberSign(passiveuserid) && bllUserShip.CancelAttention(CurrentUser.UserID, int.Parse(passiveuserid)))
                {
                    json.Accumulate("STATUS", "SUCC");
                }
                else
                {
                    json.Accumulate("STATUS", "FAIL");
                }
            }
            else
            {
                json.Accumulate("STATUS", "FAIL");
            }
            Response.Write(json.ToString());
        }
Exemple #7
0
 private void GetDepthNode(HttpContext context)
 {
     DataSet list;
     int regionId = Globals.SafeInt(context.Request.Params["NodeId"], 0);
     JsonObject obj2 = new JsonObject();
     if (regionId > 0)
     {
         Maticsoft.Model.Ms.Regions model = this.RegionBll.GetModel(regionId);
         list = this.RegionBll.GetList("Depth=" + model.Depth);
     }
     else
     {
         list = this.RegionBll.GetList("Depth=1");
     }
     if (list.Tables[0].Rows.Count < 1)
     {
         obj2.Accumulate("STATUS", "NODATA");
         context.Response.Write(obj2.ToString());
     }
     else
     {
         obj2.Accumulate("STATUS", "OK");
         obj2.Accumulate("DATA", list.Tables[0]);
         context.Response.Write(obj2.ToString());
     }
 }
 public void AddAttention(FormCollection collection)
 {
     if (!base.HttpContext.User.Identity.IsAuthenticated || (base.CurrentUser == null))
     {
         base.RedirectToAction("Login");
     }
     else
     {
         JsonObject obj2 = new JsonObject();
         string str = collection["PassiveUserID"];
         if (!string.IsNullOrWhiteSpace(str))
         {
             if (PageValidate.IsNumberSign(str) && this.bllUserShip.AddAttention(base.CurrentUser.UserID, int.Parse(str)))
             {
                 obj2.Accumulate("STATUS", "SUCC");
             }
             else
             {
                 obj2.Accumulate("STATUS", "FAIL");
             }
         }
         else
         {
             obj2.Accumulate("STATUS", "FAIL");
         }
         base.Response.Write(obj2.ToString());
     }
 }
 protected virtual void GetDepartmentMapById(HttpContext context)
 {
     JsonObject obj2 = new JsonObject();
     int departmentId = Globals.SafeInt(context.Request.Params["DepartmentId"], 0);
     if (departmentId < 1)
     {
         obj2.Accumulate("ERROR", "NOENTERPRISEID");
         context.Response.Write(obj2.ToString());
     }
     else
     {
         MapInfo modelByDepartmentId = this.mapInfoManage.GetModelByDepartmentId(departmentId);
         if (modelByDepartmentId == null)
         {
             obj2.Accumulate("STATUS", "NODATA");
             context.Response.Write(obj2.ToString());
         }
         else
         {
             obj2.Accumulate("STATUS", "OK");
             obj2.Accumulate("DATA", modelByDepartmentId);
             context.Response.Write(obj2.ToString());
         }
     }
 }
Exemple #10
0
        public void UserApprove(FormCollection collection)
        {
            JsonObject json     = new JsonObject();
            string     trueName = collection["TrueName"];
            string     IdCard   = collection["IdCardVal"];
            string     perImage = collection["hiddenIdCardPreImage"];
            string     nexImage = collection["hiddenIdCardNeImage"];

            if (!string.IsNullOrWhiteSpace(trueName) && !string.IsNullOrWhiteSpace(IdCard) && !string.IsNullOrWhiteSpace(perImage) && !string.IsNullOrWhiteSpace(nexImage))
            {
                Model.Members.UsersApprove model = new Model.Members.UsersApprove();
                model.UserID           = CurrentUser.UserID;
                model.TrueName         = trueName;
                model.IDCardNum        = IdCard;
                model.FrontView        = string.Format(perImage, "");
                model.RearView         = string.Format(nexImage, "");
                model.Status           = 0;
                model.UserType         = 0;
                model.CreatedDate      = DateTime.Now;
                Session["USERAPPROVE"] = model;
                json.Accumulate("STATUS", "SUCCESS");
            }
            else
            {
                json.Accumulate("STATUS", "FAILE");
            }
            Response.Write(json.ToString());
        }
Exemple #11
0
        public void ProcessRequest(HttpContext context)
        {
            string
                startStr = context.Request.Form["start"],
                limitStr = context.Request.Form["limit"];

            int
                start,
                limit;

            if (!int.TryParse(startStr, out start))
            {
                start = 0;
            }

            if (!int.TryParse(limitStr, out limit))
            {
                limit = 5;
            }

            context.Response.CacheControl = "no-cache";
            context.Response.AppendHeader("Pragma", "no-cache");
            context.Response.Expires     = -1;
            context.Response.ContentType = "application/json";

            JsonArray
                tmpJsonArraj = new JsonArray();

            int
                Max = 23;

            for (int i = start; (i < start + limit) && (i < Max); ++i)
            {
                JsonObject
                    tmpJsonObject = new JsonObject();

                tmpJsonObject.Accumulate("id", i);
                tmpJsonObject.Accumulate("title", "title" + i);
                tmpJsonObject.Accumulate("release_year", 1980 + i);
                tmpJsonObject.Accumulate("rating", 33 + i);

                tmpJsonArraj.Add(tmpJsonObject);
            }

            JsonObject
                RootJsonObject = new JsonObject();

            RootJsonObject.Accumulate("success", true);
            RootJsonObject.Accumulate("count", Max);
            RootJsonObject.Accumulate("movies", tmpJsonArraj);

            JsonTextWriter
                tmpJsonTextWriter = new JsonTextWriter(context.Response.Output);

            RootJsonObject.Export(tmpJsonTextWriter);

            context.Response.Flush();
            context.Response.End();
        }
Exemple #12
0
        /**
         * Processes a JSON request.
         *
         * @param request Original JSON request
         * @return The JSON response.
         */
        public JsonObject Process(JsonObject request)
        {
            JsonObject response = new JsonObject();

            JsonObject requestContext   = request.getJSONObject("context");
            JsonArray  requestedGadgets = request["gadgets"] as JsonArray;

            // Process all JSON first so that we don't wind up with hanging threads if
            // a JsonException is thrown.
            List <IAsyncResult> gadgets = new List <IAsyncResult>(requestedGadgets.Length);

            for (int i = 0, j = requestedGadgets.Length; i < j; ++i)
            {
                var context             = new JsonRpcGadgetContext(requestContext, (JsonObject)requestedGadgets[i]);
                PreloadProcessor proc   = new PreloadProcessor(CallJob);
                IAsyncResult     result = proc.BeginInvoke(context, null, null);
                gadgets.Add(result);
            }

            foreach (var entry in gadgets)
            {
                try
                {
                    AsyncResult      result = (AsyncResult)entry;
                    PreloadProcessor proc   = (PreloadProcessor)result.AsyncDelegate;
                    JsonObject       gadget = proc.EndInvoke(result);
                    response.Accumulate("gadgets", gadget);
                }
                catch (JsonException e)
                {
                    throw new RpcException("Unable to write JSON", e);
                }
                catch (Exception ee)
                {
                    if (!(ee is RpcException))
                    {
                        throw new RpcException("Processing interrupted", ee);
                    }
                    RpcException e = (RpcException)ee;
                    // Just one gadget failed; mark it as such.
                    try
                    {
                        GadgetContext context = e.Context;

                        JsonObject errorObj = new JsonObject();
                        errorObj.Put("url", context.getUrl())
                        .Put("moduleId", context.getModuleId());
                        errorObj.Accumulate("errors", e.Message);
                        response.Accumulate("gadgets", errorObj);
                    }
                    catch (JsonException je)
                    {
                        throw new RpcException("Unable to write JSON", je);
                    }
                }
            }
            return(response);
        }
Exemple #13
0
 private void EditStatus(HttpContext context)
 {
     int photoID = Globals.SafeInt(context.Request.Params["PhotoID"], 0);
     int status = Globals.SafeInt(context.Request.Params["Status"], 0);
     JsonObject obj2 = new JsonObject();
     if (this.photoBll.UpdateStatus(photoID, status))
     {
         obj2.Accumulate("STATUS", "OK");
     }
     else
     {
         obj2.Accumulate("STATUS", "NODATA");
     }
     context.Response.Write(obj2.ToString());
 }
 private void EditRecomend(HttpContext context)
 {
     int productId = Globals.SafeInt(context.Request.Params["ProductId"], 0);
     int recomend = Globals.SafeInt(context.Request.Params["Recomend"], 0);
     JsonObject obj2 = new JsonObject();
     if (this.productBll.UpdateRecomend(productId, recomend))
     {
         obj2.Accumulate("STATUS", "OK");
     }
     else
     {
         obj2.Accumulate("STATUS", "NODATA");
     }
     context.Response.Write(obj2.ToString());
 }
    public JsonArray getAllCareerOpportunities()
    {
        JsonArray  ja = new JsonArray();
        JsonObject jo;
        String     tmpStr;

        dbAccess.open();
        try
        {
            string sql = " select [CareerOpportunity].ID, SerialNo, PositionPara.Description Title,Status,'Career' Category, SystemPara.Description Type,  left(CONVERT(VARCHAR, [CreateDate], " + GlobalSetting.DatabaseDateTimeFormat + "),10) EffectiveDate from [CareerOpportunity] "
                         + " left outer join SystemPara on category = 'CareerType' and [CareerOpportunity].type = SystemPara.ID "
                         + " left outer join SystemPara PositionPara  on PositionPara.category = 'Position' and [CareerOpportunity].JobFunction = PositionPara.ID "
                         + " where status <> 'Trashed' order by status, CreateDate desc, SerialNo ";
            System.Data.DataTable dt = dbAccess.select(sql);
            foreach (System.Data.DataRow dr in dt.Rows)
            {
                jo = new JsonObject();
                foreach (System.Data.DataColumn col in dt.Columns)
                {
                    tmpStr = dr[col.ColumnName].ToString();
                    jo.Accumulate(col.ColumnName.ToLower(), tmpStr);
                }
                ja.Add(jo);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            dbAccess.close();
        }
        return(ja);
    }
Exemple #16
0
    public Jayrock.Json.JsonObject getUserStatus()
    {
        JsonObject status = new JsonObject();

        //create database access object
        String sql = "SELECT distinct [Status] FROM [DetailUser] where UserGroup <> '" + GlobalSetting.SystemRoles.Admin + "' ";

        dbAccess.open();
        try
        {
            System.Data.DataTable dt = dbAccess.select(sql);
            if (dt.Rows.Count > 0)
            {
                foreach (System.Data.DataRow row in dt.Rows)
                {
                    foreach (System.Data.DataColumn col in dt.Columns)
                    {
                        status.Accumulate(row[col.ColumnName].ToString(), row[col.ColumnName].ToString());
                    }
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            dbAccess.close();
        }

        return(status);
    }
Exemple #17
0
    public Jayrock.Json.JsonArray getEventByMonth(DateTime dateOfMonth)
    {
        JsonArray  events = new JsonArray();
        JsonObject tmpEvent;

        DateTime startime = new DateTime(dateOfMonth.Year, dateOfMonth.Month, 1).AddMonths(0);
        DateTime endtime  = new DateTime(dateOfMonth.Year, dateOfMonth.Month, 1).AddMonths(1);

        //create database access object
        String sql = " SELECT Event.[ID] ,[Name] ,CONVERT(VARCHAR, [StartTime], 120) [StartTime], "
                     + " CONVERT(VARCHAR, [EndTime], 120) [EndTime], 'Event' Type, "
                     + " SystemParaBuildin.ProgramCode"
                     + " FROM [Event] "
                     + " left outer join [SystemParaBuildin] on Type = SystemParaBuildin.ID "
                     + " where (([StartTime] >= @StartTime and [StartTime] <= @EndTime) "
                     + " or ([EndTime] >= @StartTime and [EndTime] <= @EndTime)) and Status = 'Published' "
                     + " union all "
                     + " SELECT distinct [Training].[ID] ,[Name] ,CONVERT(VARCHAR, StartTime, 120) [StartTime] , "
                     + " CONVERT(VARCHAR, [EndTime], 120) [EndTime], 'Training' Type, '' ProgramCode "
                     + " FROM [Training] "
                     + " join TrainingSche on Training.ID =  TrainingSche.TrainingID  "
                     + " where (([StartTime] >= @StartTime  "
                     + " and [StartTime] <= @EndTime)   "
                     + " or ([EndTime] >= @StartTime and [EndTime] <= @EndTime))  "
                     + " and  Status = 'Published'  order by StartTime ";

        Dictionary <string, object> dict = new Dictionary <string, object>();

        dict.Add("@StartTime", startime);
        dict.Add("@EndTime", endtime);

        dbAccess.open();
        try
        {
            System.Data.DataTable dt = dbAccess.select(sql, dict);
            if (dt.Rows.Count > 0)
            {
                foreach (System.Data.DataRow row in dt.Rows)
                {
                    tmpEvent = new JsonObject();
                    foreach (System.Data.DataColumn col in dt.Columns)
                    {
                        tmpEvent.Accumulate(col.ColumnName.ToLower(), row[col.ColumnName]);
                    }

                    events.Add(tmpEvent);
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            dbAccess.close();
        }

        return(events);
    }
Exemple #18
0
    public Jayrock.Json.JsonArray getSystemLinkList()
    {
        Jayrock.Json.JsonArray  ja = new Jayrock.Json.JsonArray();
        Jayrock.Json.JsonObject jo;
        string sql = "select ID, name, link from OtherSystemLink";

        dbAccess.open();

        try
        {
            System.Data.DataTable dt = dbAccess.select(sql);

            foreach (System.Data.DataRow dr in dt.Rows)
            {
                jo = new JsonObject();
                foreach (System.Data.DataColumn col in dt.Columns)
                {
                    jo.Accumulate(col.ColumnName.ToLower(), dr[col.ColumnName].ToString());
                }
                ja.Add(jo);
            }
        }
        catch
        {
            throw;
        }
        finally
        {
            dbAccess.close();
        }

        return(ja);
    }
 private void SetAdmin(HttpContext context)
 {
     int groupID = Globals.SafeInt(context.Request.Params["GroupID"], 0);
     int userID = Globals.SafeInt(context.Request.Params["UserID"], 0);
     int role = Globals.SafeInt(context.Request.Params["Role"], 0);
     JsonObject obj2 = new JsonObject();
     if (this.groupUserBll.UpdateRole(groupID, userID, role))
     {
         obj2.Accumulate("STATUS", "OK");
     }
     else
     {
         obj2.Accumulate("STATUS", "NODATA");
     }
     context.Response.Write(obj2.ToString());
 }
Exemple #20
0
        public void SubmitSucc()
        {
            ViewBag.Title = "实名认证";
            JsonObject json = new JsonObject();

            BLL.Members.UsersApprove manage = new BLL.Members.UsersApprove();
            if (manage.DeleteByUserId(CurrentUser.UserID))
            {
                json.Accumulate("STATUS", "SUCCESS");
            }
            else
            {
                json.Accumulate("STATUS", "FAILE");
            }
            Response.Write(json.ToString());
        }
Exemple #21
0
 public void UpdateUserInfo(FormCollection collection)
 {
     if (!HttpContext.User.Identity.IsAuthenticated || CurrentUser == null)
     {
         RedirectToAction(ViewBag.BasePath + "Account/Login");//去登录
     }
     else
     {
         JsonObject json = new JsonObject();
         Model.Members.UsersExpModel model = bllUE.GetUsersModel(CurrentUser.UserID);
         if (null == model)
         {
             RedirectToAction("Login");//去登录
         }
         else
         {
             model.TelPhone = collection["TelPhone"];
             string birthday = collection["Birthday"];
             if (!string.IsNullOrWhiteSpace(birthday) && PageValidate.IsDateTime(birthday))
             {
                 model.Birthday = Globals.SafeDateTime(birthday, DateTime.Now);
             }
             else
             {
                 model.Birthday = null;
             }
             model.Constellation  = collection["Constellation"];  //星座
             model.PersonalStatus = collection["PersonalStatus"]; //职业
             model.Singature      = collection["Singature"];
             model.Address        = collection["Address"];
             User currentUser = new YSWL.Accounts.Bus.User(CurrentUser.UserID);
             currentUser.Sex      = collection["Sex"];
             currentUser.Email    = collection["Email"];
             currentUser.NickName = collection["NickName"];
             currentUser.Phone    = collection["Phone"];
             if (currentUser.Update() && bllUE.Update(model))
             {
                 json.Accumulate("STATUS", "SUCC");
             }
             else
             {
                 json.Accumulate("STATUS", "FAIL");
             }
             Response.Write(json.ToString());
         }
     }
 }
Exemple #22
0
 protected void SetDepartmentMap(HttpContext context)
 {
     JsonObject obj2 = new JsonObject();
     User user = context.Session[Globals.SESSIONKEY_ENTERPRISE] as User;
     if (user != null)
     {
         int num = Globals.SafeInt(context.Request.Params["DepartmentId"], 0);
         string str = context.Request.Params["MarkersLongitude"];
         string str2 = context.Request.Params["MarkersDimension"];
         string target = context.Request.Params["PointerTitle"];
         string content = context.Request.Params["PointerContent"];
         string str5 = context.Request.Params["PointImg"];
         int num2 = Globals.SafeInt(context.Request.Params["MapId"], 0);
         if (num < 1)
         {
             obj2.Accumulate("ERROR", "NOENTERPRISEID");
             context.Response.Write(obj2.ToString());
         }
         else
         {
             MapInfo model = new MapInfo {
                 UserId = user.UserID,
                 DepartmentId = num,
                 MarkersLongitude = str,
                 MarkersDimension = str2,
                 PointerTitle = Globals.HtmlEncode(target),
                 PointerContent = Globals.HtmlEncodeForSpaceWrap(content)
             };
             if (!string.IsNullOrWhiteSpace(str5))
             {
                 model.PointImg = str5;
             }
             if (num2 < 1)
             {
                 model.MapId = base.mapInfoManage.Add(model);
             }
             else
             {
                 model.MapId = num2;
                 base.mapInfoManage.Update(model);
             }
             obj2.Accumulate("STATUS", "OK");
             obj2.Accumulate("DATA", model);
             context.Response.Write(obj2.ToString());
         }
     }
 }
 public void SubmitPoll(FormCollection collection)
 {
     JsonObject obj2 = new JsonObject();
     if (base.Request.Cookies["vote" + collection["FID"]] != null)
     {
         obj2.Accumulate("STATUS", "805");
         obj2.Accumulate("DATA", "您已经投过票,请不要重复投票!");
     }
     else
     {
         Maticsoft.Model.Poll.UserPoll model = new Maticsoft.Model.Poll.UserPoll();
         Maticsoft.BLL.Poll.UserPoll poll2 = new Maticsoft.BLL.Poll.UserPoll();
         model.UserID = Globals.SafeInt(collection["UID"], 0);
         model.UserIP = base.Request.UserHostAddress;
         string str = collection["Option"];
         if (!string.IsNullOrWhiteSpace(str))
         {
             string[] strArray = str.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
             int num = 0;
             foreach (string str2 in strArray)
             {
                 string[] strArray2 = str2.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries);
                 model.TopicID = new int?(Globals.SafeInt(strArray2[0], -1));
                 model.OptionID = new int?(Globals.SafeInt(strArray2[1], -1));
                 poll2.Add(model);
                 num++;
             }
             if (num == strArray.Length)
             {
                 HttpCookie cookie = new HttpCookie("vote" + collection["FID"]);
                 cookie.Values.Add("voteid", collection["FID"]);
                 cookie.Expires = DateTime.Now.AddHours(240.0);
                 base.Response.Cookies.Add(cookie);
                 obj2.Accumulate("STATUS", "800");
             }
             else
             {
                 obj2.Accumulate("STATUS", "804");
             }
         }
         else
         {
             obj2.Accumulate("STATUS", "804");
         }
     }
     base.Response.Write(obj2.ToString());
 }
Exemple #24
0
 private void GetChildNode(HttpContext context)
 {
     string str = context.Request.Params["ParentId"];
     JsonObject obj2 = new JsonObject();
     DataSet regionName = this.RegionBll.GetRegionName(string.IsNullOrWhiteSpace(str) ? "0" : str);
     if (regionName.Tables[0].Rows.Count < 1)
     {
         obj2.Accumulate("STATUS", "NODATA");
         context.Response.Write(obj2.ToString());
     }
     else
     {
         obj2.Accumulate("STATUS", "OK");
         obj2.Accumulate("DATA", regionName.Tables[0]);
         context.Response.Write(obj2.ToString());
     }
 }
Exemple #25
0
        public void ProcessRequest(HttpContext context)
        {
            System.Threading.Thread.Sleep(3000);

            string
                GenerateStatusCode,
                StatusCodeStr,
                WriteToResponse;

            int
                StatusCode;

            if (!string.IsNullOrEmpty(GenerateStatusCode = context.Request.Form["GenerateStatusCode"]) &&
                GenerateStatusCode.Trim().ToLower() == "true" &&
                !string.IsNullOrEmpty(StatusCodeStr = context.Request.Form["StatusCode"]) &&
                int.TryParse(StatusCodeStr, out StatusCode))
            {
                context.Response.StatusCode = StatusCode;

                if (!string.IsNullOrEmpty(WriteToResponse = context.Request.Form["WriteToResponse"]) &&
                    WriteToResponse.Trim().ToLower() == "true")
                {
                    context.Response.Write("blah-blah-blah");
                }

                context.Response.End();

                return;
            }

            context.Response.CacheControl = "no-cache";
            context.Response.Expires      = -1;
            context.Response.ContentType  = "application/json";

            JsonObject
                tmpJsonObject = new JsonObject(new Dictionary <string, object> {
                { "success", true }
            });

            string
                type;

            if (!string.IsNullOrEmpty(type = context.Request.Form["type"]) &&
                type.Trim().ToLower() == "load")
            {
                tmpJsonObject.Accumulate("data", new JsonObject(new Dictionary <string, object> {
                    { "TextField", "TextField" }
                }));
            }

            JsonTextWriter
                tmpJsonTextWriter = new JsonTextWriter(context.Response.Output);

            tmpJsonObject.Export(tmpJsonTextWriter);
            tmpJsonTextWriter.Flush();
            tmpJsonTextWriter.Close();
        }
Exemple #26
0
        JsonArray GetChildren(DataTable dt, ulong?ParentId, uint Level)
        {
            JsonArray
                JsonArray = null;

            DataRow[]
            DataRows = dt.Select((ParentId.HasValue ? "(PARENTID=" + ParentId.Value + ")" : "(PARENTID is null)") + " and (L=" + Level + ")");

            if (DataRows.Length == 0)
            {
                return(JsonArray);
            }

            JsonArray = new JsonArray();

            foreach (DataRow row in DataRows)
            {
                ulong
                             Id = Convert.ToUInt64(row["ID"]);

                JsonObject
                    JsonObject = new JsonObject(new Dictionary <string, object> {
                    { "id", Id }, { "nodeId", Id }, { "pnodeID", ParentId.HasValue ? (object)ParentId.Value : null }, { "text", row["VAL"] }
                });

                if (Id == 8)
                {
                    JsonObject.Accumulate("checked", true);
                }

                JsonArray
                    Children;

                JsonObject.Accumulate("leaf", (Children = GetChildren(dt, Id, Level + 1)) == null);
                if (Children != null)
                {
                    JsonObject.Accumulate("children", Children);
                }

                JsonArray.Add(JsonObject);
            }

            return(JsonArray);
        }
Exemple #27
0
        JsonObject GetData(int start, int limit)
        {
            JsonObject
                tmpJsonObject = new JsonObject();

            JsonArray
                tmpJsonArray = new JsonArray();

            using (SqlConnection conn = new SqlConnection(GetConnectionString()))
            {
                conn.Open();

                SqlCommand
                    cmd = conn.CreateCommand();

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "GetStaffPage";
                SqlCommandBuilder.DeriveParameters(cmd);
                cmd.Parameters["@start"].Value = start;
                cmd.Parameters["@limit"].Value = limit;

                using (SqlDataReader r = cmd.ExecuteReader())
                {
                    if (r.HasRows)
                    {
                        int
                            idx = r.GetOrdinal("BirthDate");

                        while (r.Read())
                        {
                            tmpJsonArray.Add(new JsonObject(new Dictionary <string, object> {
                                { "Id", r["Id"] }, { "Name", r["Name"] }, { "Salary", r["Salary"] }, { "Dep", r["Dep"] }, { "BirthDate", r["BirthDate"] }
                            }));
                        }
                    }
                }
            }

            tmpJsonObject.Accumulate("success", true);
            tmpJsonObject.Accumulate("count", GetCount());
            tmpJsonObject.Accumulate("rows", tmpJsonArray);

            return(tmpJsonObject);
        }
 public void ProcessRequest(HttpContext context)
 {
     JsonObject obj2 = new JsonObject();
     context.Response.ContentType = "application/json";
     if (!this.CheckUser(context))
     {
         context.Response.Write("{\"STATUS\":\"NOLONGIN\"}");
         obj2.Accumulate("STATUS", "NOLONGIN");
     }
     else
     {
         try
         {
             string actionName = context.Request["Action"];
             string str2 = actionName;
             if (str2 == null)
             {
                 goto Label_009E;
             }
             if (!(str2 == "CkeckLogin"))
             {
                 if (str2 == "GetDepartmentMapById")
                 {
                     goto Label_0095;
                 }
                 goto Label_009E;
             }
             obj2.Accumulate("STATUS", "OK");
             context.Response.Write(obj2.ToString());
             return;
         Label_0095:
             this.GetDepartmentMapById(context);
             return;
         Label_009E:
             this.ProcessAction(actionName, context);
         }
         catch (Exception exception)
         {
             obj2.Accumulate("ERROR", exception.Message.Replace("\"", "'"));
             context.Response.Write(obj2.ToString());
         }
     }
 }
Exemple #29
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.CacheControl = "no-cache";
            context.Response.AppendHeader("Pragma", "no-cache");
            context.Response.Expires     = -1;
            context.Response.ContentType = "application/json";

            JsonArray
                tmpJsonArraj = new JsonArray();

            int
                Max = 23;

            for (int i = 0; i < Max; ++i)
            {
                JsonObject
                    tmpJsonObject = new JsonObject();

                tmpJsonObject.Accumulate("id", i);
                tmpJsonObject.Accumulate("title", "title" + i);
                tmpJsonObject.Accumulate("release_year", 1980 + i);
                tmpJsonObject.Accumulate("rating", 33 + i);
                tmpJsonObject.Accumulate("genre", Max / (i + 1));

                tmpJsonArraj.Add(tmpJsonObject);
            }

            JsonObject
                RootJsonObject = new JsonObject();

            RootJsonObject.Accumulate("success", true);
            RootJsonObject.Accumulate("movies", tmpJsonArraj);

            JsonTextWriter
                tmpJsonTextWriter = new JsonTextWriter(context.Response.Output);

            RootJsonObject.Export(tmpJsonTextWriter);

            context.Response.Flush();
            context.Response.End();
        }
 private void DeleteFile(HttpContext context)
 {
     JsonObject obj2 = new JsonObject();
     string str = context.Request.Form["FilePath"];
     if (!string.IsNullOrWhiteSpace(str))
     {
         if (FileManage.DeleteFile(context.Server.MapPath(str)))
         {
             obj2.Accumulate("STATUS", "SUCCESS");
         }
         else
         {
             obj2.Accumulate("STATUS", "FAILED");
         }
     }
     else
     {
         obj2.Accumulate("STATUS", "ERROR");
     }
     context.Response.Write(obj2.ToString());
 }
Exemple #31
0
    public JsonArray getTrainingDecision(int ID, int loginID)
    {
        Jayrock.Json.JsonArray  ja = new JsonArray();
        Jayrock.Json.JsonObject jo;
        string sql = "select "
                     + "case when a.UserAction = 'NotAttend' then 'Not Attend' else a.UserAction END 'Decision' , "
                     + "Convert(varchar,s.StartTime, 103) + ' ' + "
                     + "left(Convert(varchar,s.StartTime, 114),5) 'DateTime' "
                     + "FROM ActivityLog a  "
                     + "join Training t on a.ActivityID = t.ID  "
                     + "join TrainingSche s on s.TrainingID = a.ActivityID and s.ID = a.ExtField "
                     + "where a.ExtField is not null and a.Category = 'Training' and t.ID = @ID and a.UserID = @UserID "
                     + "union all "
                     + "select "
                     + "case when a.UserAction = 'NotAttend' then 'Not Attend' else a.UserAction END 'Decision' , "
                     + "'' 'DateTime' "
                     + "FROM ActivityLog a  "
                     + "join Training t on a.ActivityID = t.ID  "
                     + "where a.ExtField is null and a.Category = 'Training' and t.ID = @ID and a.UserID = @UserID ";

        Dictionary <string, object> dict = new Dictionary <string, object>();

        dict.Add("@ID", ID);
        dict.Add("@UserID", loginID);

        dbAccess.open();

        try
        {
            System.Data.DataTable dt = dbAccess.select(sql, dict);

            foreach (System.Data.DataRow row in dt.Rows)
            {
                jo = new JsonObject();
                foreach (System.Data.DataColumn col in dt.Columns)
                {
                    jo.Accumulate(col.ColumnName.ToLower(), row[col.ColumnName]);
                }

                ja.Add(jo);
            }
        }
        catch
        {
            throw;
        }
        finally
        {
            dbAccess.close();
        }

        return(ja);
    }
        JsonObject GetMetaDataJson()
        {
            JsonObject
                MetaDataJsonObject = new JsonObject();

            JsonArray
                MetaDataJsonArray = new JsonArray();

            MetaDataJsonArray.Add(new JsonObject(new string[] { "name", "type" }, new object[] { "Id", "int" }));
            MetaDataJsonArray.Add(new JsonObject(new string[] { "name", "type" }, new object[] { "Name", "string" }));
            MetaDataJsonArray.Add(new JsonObject(new string[] { "name", "type" }, new object[] { "Salary", "float" }));
            MetaDataJsonArray.Add(new JsonObject(new string[] { "name", "type", "dateFormat" }, new object[] { "BirthDate", "date", "c" }));
            MetaDataJsonArray.Add(new JsonObject(new string[] { "name", "type" }, new object[] { "Checked", "boolean" }));
            MetaDataJsonObject.Accumulate("idProperty", "Id");
            MetaDataJsonObject.Accumulate("root", "rows");
            MetaDataJsonObject.Accumulate("totalProperty", "count");
            MetaDataJsonObject.Accumulate("successProperty", "success");
            MetaDataJsonObject.Accumulate("fields", MetaDataJsonArray);

            return(MetaDataJsonObject);
        }
Exemple #33
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.CacheControl = "no-cache";
            context.Response.AppendHeader("Pragma", "no-cache");
            context.Response.Expires     = -1;
            context.Response.ContentType = "application/json";

            JsonArray
                tmpJsonArraj = new JsonArray();

            int
                Max = 3;

            for (int i = 0; i < Max; ++i)
            {
                JsonObject
                    tmpJsonObject = new JsonObject();

                tmpJsonObject.Accumulate("ContragentId", i + 1);
                tmpJsonObject.Accumulate("Name", "Name" + (i + 1));
                tmpJsonObject.Accumulate("Job", "Job" + (i + 1));

                tmpJsonArraj.Add(tmpJsonObject);
            }

            JsonObject
                RootJsonObject = new JsonObject();

            //RootJsonObject.Accumulate("success", true);
            //RootJsonObject.Accumulate("results", Max);
            RootJsonObject.Accumulate("rows", tmpJsonArraj);

            JsonTextWriter
                tmpJsonTextWriter = new JsonTextWriter(context.Response.Output);

            RootJsonObject.Export(tmpJsonTextWriter);

            context.Response.Flush();
            context.Response.End();
        }
Exemple #34
0
        public ActionResult AddTopicFav(int topicId)
        {
            JsonObject jsonObject = new JsonObject();

            if (null == currentUser)
            {
                jsonObject.Accumulate("result", "3");//3表示没有登录
                return(base.Json(jsonObject));
            }
            YSWL.MALL.Model.SNS.GroupTopics topicsModel = bllTopic.GetModelByCache(topicId);
            HttpCookie cookie = Request.Cookies["topicFav_" + topicId + CurrentUser.UserID];

            if (null != cookie)//取消赞
            {
                cookie         = new HttpCookie("topicFav_" + topicId + CurrentUser.UserID);
                cookie.Expires = DateTime.Now.AddDays(-1);
                Response.Cookies.Add(cookie);
                if (!OperateTopic(topicsModel, 0))
                {
                    jsonObject.Accumulate("result", "0");//失败了
                    return(base.Json(jsonObject));
                }
            }
            else//赞
            {
                cookie = new HttpCookie("topicFav_" + topicId + CurrentUser.UserID);
                Response.Cookies.Add(cookie);
                if (!OperateTopic(topicsModel, 1))
                {
                    jsonObject.Accumulate("result", "0");//失败了
                    return(base.Json(jsonObject));
                }
                cookie.Value = "HasSupport";
            }
            int count = topicsModel.FavCount;

            jsonObject.Accumulate("totalCount", count);
            jsonObject.Accumulate("result", "1");//1代表成功
            return(base.Json(jsonObject));
        }
 private void ContentAttachmentUpload(HttpRequest Request, HttpResponse Response)
 {
     HttpPostedFile file = Request.Files["Filedata"];
     Response.Charset = "utf-8";
     string valueByCache = ConfigSystem.GetValueByCache("UploadAttachmentPath");
     if (file != null)
     {
         string path = HttpContext.Current.Server.MapPath("/" + valueByCache);
         if (!Directory.Exists(path))
         {
             Directory.CreateDirectory(path);
         }
         string str3 = Path.GetExtension(file.FileName).ToLower();
         string str4 = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture) + str3;
         string filename = path + str4;
         JsonObject obj2 = new JsonObject();
         try
         {
             file.SaveAs(filename);
             obj2.Accumulate("Status", "OK");
             obj2.Accumulate("SavePath", valueByCache + str4);
             Response.Write("1|" + obj2.ToString());
         }
         catch (Exception)
         {
             obj2.Accumulate("Status", "Failed");
             obj2.Accumulate("ErrorMessage", "ERROR501,请联系管理员!");
             Response.Write("0|" + obj2.ToString());
         }
     }
     else
     {
         JsonObject obj3 = new JsonObject();
         obj3.Accumulate("Status", "Failed");
         obj3.Accumulate("ErrorMessage", "ERROR502,请联系管理员!");
         Response.Write("0|" + obj3.ToString());
     }
 }
Exemple #36
0
 public void UpdateUserPassword(FormCollection collection)
 {
     if (!HttpContext.User.Identity.IsAuthenticated || CurrentUser == null)
     {
         RedirectToAction(ViewBag.BasePath + "Account/Login");//去登录
     }
     else
     {
         JsonObject json            = new JsonObject();
         string     newpassword     = collection["NewPassword"];
         string     confirmpassword = collection["ConfirmPassword"];
         if (!string.IsNullOrWhiteSpace(newpassword) && !string.IsNullOrWhiteSpace(confirmpassword))
         {
             if (newpassword.Trim() != confirmpassword.Trim())
             {
                 json.Accumulate("STATUS", "FAIL");
             }
             else
             {
                 currentUser.Password = AccountsPrincipal.EncryptPassword(newpassword);
                 if (currentUser.Update())
                 {
                     json.Accumulate("STATUS", "UPDATESUCC");
                 }
                 else
                 {
                     json.Accumulate("STATUS", "UPDATEFAIL");
                 }
             }
         }
         else
         {
             json.Accumulate("STATUS", "UNDEFINED");
         }
         Response.Write(json.ToString());
     }
 }
Exemple #37
0
 public void SendMsg(FormCollection collection)
 {
     ViewBag.Title = "发信息";
     if (!HttpContext.User.Identity.IsAuthenticated || CurrentUser == null)
     {
         RedirectToAction(ViewBag.BasePath + "Account/Login");//去登录
     }
     else
     {
         JsonObject json     = new JsonObject();
         string     nickname = collection["NickName"];
         string     title    = collection["Title"];
         string     content  = collection["Content"];
         if (string.IsNullOrWhiteSpace(nickname))
         {
             json.Accumulate("STATUS", "NICKNAMENULL");
         }
         else if (string.IsNullOrWhiteSpace(title))
         {
             json.Accumulate("STATUS", "TITLENULL");
         }
         else if (string.IsNullOrWhiteSpace(content))
         {
             json.Accumulate("STATUS", "CONTENTNULL");
         }
         else
         {
             BLL.Members.Users bll = new BLL.Members.Users();
             if (bll.ExistsNickName(nickname))
             {
                 int ReceiverID = bll.GetUserIdByNickName(nickname);
                 YSWL.MALL.Model.Members.SiteMessage modeSiteMessage = new YSWL.MALL.Model.Members.SiteMessage();
                 modeSiteMessage.Title          = title;
                 modeSiteMessage.Content        = content;
                 modeSiteMessage.SenderID       = CurrentUser.UserID;
                 modeSiteMessage.ReaderIsDel    = false;
                 modeSiteMessage.ReceiverIsRead = false;
                 modeSiteMessage.SenderIsDel    = false;
                 modeSiteMessage.ReceiverID     = ReceiverID;
                 modeSiteMessage.SendTime       = DateTime.Now;
                 if (bllSM.Add(modeSiteMessage) > 0)
                 {
                     json.Accumulate("STATUS", "SUCC");
                 }
                 else
                 {
                     json.Accumulate("STATUS", "FAIL");
                 }
             }
             else
             {
                 json.Accumulate("STATUS", "NICKNAMENOTEXISTS");
             }
         }
         Response.Write(json.ToString());
     }
 }
Exemple #38
0
        public void SubmitApprove(FormCollection collection)
        {
            JsonObject json = new JsonObject();

            if (Session["USERAPPROVE"] != null)
            {
                BLL.Members.UsersApprove   manage = new BLL.Members.UsersApprove();
                Model.Members.UsersApprove model  = new Model.Members.UsersApprove();
                model = (Model.Members.UsersApprove)Session["USERAPPROVE"];

                //上传的图片移动文件夹
                string    tempFile  = string.Format("/Upload/Temp/{0}/", DateTime.Now.ToString("yyyyMMdd"));
                string    ImageFile = "/Upload/SNS/Images/ApproveImage/";
                ArrayList imageList = new ArrayList();

                imageList.Add(model.FrontView.Replace(tempFile, ""));
                imageList.Add(model.RearView.Replace(tempFile, ""));

                model.FrontView = model.FrontView.Replace(tempFile, ImageFile);
                model.RearView  = model.RearView.Replace(tempFile, ImageFile);
                if (manage.Add(model) > 0)
                {
                    Common.FileManage.MoveFile(Server.MapPath(tempFile), Server.MapPath(ImageFile), imageList);
                    Session["USERAPPROVE"] = null;
                    json.Accumulate("STATUS", "SUCCESS");
                }
                else
                {
                    json.Accumulate("STATUS", "FAILE");
                }
            }
            else
            {
                json.Accumulate("STATUS", "FAILE");
            }
            Response.Write(json.ToString());
        }
Exemple #39
0
    public Jayrock.Json.JsonArray getTrainingSchedule(int id)
    {
        JsonArray  scheList = new JsonArray();
        JsonObject tmpSche;

        String sql = string.Format("select * from TrainingSche where TrainingID = {0}",
                                   id);

        dbAccess.open();
        try
        {
            System.Data.DataTable dt = dbAccess.select(sql);


            foreach (System.Data.DataRow row in dt.Rows)
            {
                tmpSche = new JsonObject();
                tmpSche.Accumulate("ID", row["ID"].ToString());
                tmpSche.Accumulate("scheduleDate", Convert.ToDateTime(row["StartTime"]).ToString(GlobalSetting.DateTimeFormat));
                tmpSche.Accumulate("startTime", Convert.ToDateTime(row["StartTime"]).ToString("HH:mm"));
                tmpSche.Accumulate("endTime", Convert.ToDateTime(row["EndTime"]).ToString("HH:mm"));

                scheList.Add(tmpSche);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            dbAccess.close();
        }

        return(scheList);
    }
Exemple #40
0
    public JsonArray GetFileList(string type, string directory)
    {
        JsonArray  ja = new JsonArray();
        JsonObject jo;
        String     tmpStr;

        string sql = string.Format("select [Directory].ID DirectoryID, [File].ID, [Directory].FullName directory, [File].Name fileName, [File].OriginalName orginFileName, [File].Description , [File].Status,[File].uploaddate uploadDate from [File] "
                                   + "join [Path] on [File].ID = [Path].ID and [Path].Type = 'F' "
                                   + "join [Directory] on [Directory].ID = [Path].DirectoryID "
                                   + " where [File].Type = '{0}' and ('{1}' = 'All' or [Directory].FullName = '{1}' )"
                                   + " order by directory", type, directory);

        this.dbAccess.open();
        try
        {
            System.Data.DataTable dt = dbAccess.select(sql);

            foreach (System.Data.DataRow dr in dt.Rows)
            {
                jo = new JsonObject();
                foreach (System.Data.DataColumn col in dt.Columns)
                {
                    if (col.DataType == System.Type.GetType("System.DateTime"))
                    {
                        tmpStr = Convert.ToDateTime(dr[col.ColumnName]).ToString(GlobalSetting.DateTimeFormat);
                    }
                    else
                    {
                        tmpStr = dr[col.ColumnName].ToString();
                    }

                    jo.Accumulate(col.ColumnName.ToLower(), tmpStr);
                }
                ja.Add(jo);
            }
        }
        catch
        {
            throw;
        }
        finally
        {
            this.dbAccess.close();
        }
        return(ja);
    }
Exemple #41
0
    public JsonArray GetDirectoryList(string type)
    {
        JsonArray  ja = new JsonArray();
        JsonObject jo;
        String     tmpStr;

        string sql = " select FullName from Directory "
                     + " where Type = '" + type + "'"
                     + " order by FullName";

        this.dbAccess.open();
        try
        {
            System.Data.DataTable dt = dbAccess.select(sql);

            foreach (System.Data.DataRow dr in dt.Rows)
            {
                jo = new JsonObject();
                foreach (System.Data.DataColumn col in dt.Columns)
                {
                    if (col.DataType == System.Type.GetType("System.DateTime"))
                    {
                        tmpStr = Convert.ToDateTime(dr[col.ColumnName]).ToString(GlobalSetting.DateTimeFormat);
                    }
                    else
                    {
                        tmpStr = dr[col.ColumnName].ToString();
                    }
                    jo.Accumulate(col.ColumnName.ToLower(), tmpStr);
                }
                ja.Add(jo);
            }
        }
        catch
        {
            throw;
        }
        finally
        {
            this.dbAccess.close();
        }
        return(ja);
    }
Exemple #42
0
    public Jayrock.Json.JsonArray getTrainingFormList(int id)
    {
        JsonArray  scheList = new JsonArray();
        JsonObject tmpSche;

        String sql = string.Format("select [File].ID FileID, *, SystemPara.SubSequence "
                                   + " from TrainingForm "
                                   + " join SystemPara on formType = SystemPara.ID"
                                   + " left outer join [File] on TrainingForm.ID = [File].ParentID and [File].Type = {1}"
                                   + "where TrainingID = {0} ", id, File.ArticleFileType.Training);

        dbAccess.open();
        try
        {
            System.Data.DataTable dt = dbAccess.select(sql);


            foreach (System.Data.DataRow row in dt.Rows)
            {
                tmpSche = new JsonObject();
                tmpSche.Accumulate("ID", row["ID"].ToString());
                tmpSche.Accumulate("FormType", row["FormType"].ToString());
                tmpSche.Accumulate("Description", row["Description"].ToString());
                tmpSche.Accumulate("SubSequence", row["SubSequence"].ToString());

                if (row["FileID"] == DBNull.Value)
                {
                    tmpSche.Accumulate("FormPath", row["FormPath"].ToString());
                }
                else
                {
                    tmpSche.Accumulate("FormPath", "Service/FileService.aspx?ID=" + row["FileID"].ToString());
                }

                scheList.Add(tmpSche);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            dbAccess.close();
        }

        return(scheList);
    }
Exemple #43
0
 public string GetUserName(string prefixText, int limit)
 {
     if (string.IsNullOrWhiteSpace(prefixText))
     {
         return string.Empty;
     }
     string strUName = this.HtmlEncode(prefixText);
     DataSet userName = new UsersExp().GetUserName(strUName, limit);
     JsonArray array = new JsonArray();
     if (userName.Tables[0].Rows.Count > 0)
     {
         for (int i = 0; i < userName.Tables[0].Rows.Count; i++)
         {
             string tmpStr = userName.Tables[0].Rows[i]["UserName"].ToString();
             if (this.CheckHtmlCode(ref tmpStr, prefixText))
             {
                 JsonObject obj2 = new JsonObject();
                 obj2.Accumulate("name", tmpStr);
                 array.Add(obj2);
             }
         }
     }
     return array.ToString();
 }
 public void SendMsg(FormCollection collection)
 {
     JsonObject obj2 = new JsonObject();
     string str = InjectionFilter.Filter(collection["NickName"]);
     string str2 = InjectionFilter.Filter(collection["Content"]);
     string str3 = InjectionFilter.Filter(collection["Content"]);
     if (string.IsNullOrWhiteSpace(str))
     {
         obj2.Accumulate("STATUS", "NICKNAMENULL");
     }
     else if (string.IsNullOrWhiteSpace(str2))
     {
         obj2.Accumulate("STATUS", "TITLENULL");
     }
     else if (string.IsNullOrWhiteSpace(str3))
     {
         obj2.Accumulate("STATUS", "CONTENTNULL");
     }
     else
     {
         Maticsoft.BLL.Members.Users users = new Maticsoft.BLL.Members.Users();
         if (users.ExistsNickName(str))
         {
             int userIdByNickName = users.GetUserIdByNickName(str);
             Maticsoft.Model.Members.SiteMessage model = new Maticsoft.Model.Members.SiteMessage {
                 Title = str2,
                 Content = str3,
                 SenderID = new int?(base.CurrentUser.UserID),
                 ReaderIsDel = false,
                 ReceiverIsRead = false,
                 SenderIsDel = false,
                 ReceiverID = new int?(userIdByNickName),
                 SendTime = new DateTime?(DateTime.Now)
             };
             if (this.bllSM.Add(model) > 0)
             {
                 obj2.Accumulate("STATUS", "SUCC");
             }
             else
             {
                 obj2.Accumulate("STATUS", "FAIL");
             }
         }
         else
         {
             obj2.Accumulate("STATUS", "NICKNAMENOTEXISTS");
         }
     }
     base.Response.Write(obj2.ToString());
 }
 public void ReplyMsg(int ReceiverID, string Title, string Content)
 {
     JsonObject obj2 = new JsonObject();
     Maticsoft.Model.Members.SiteMessage model = new Maticsoft.Model.Members.SiteMessage {
         Title = Title,
         Content = Content,
         SenderID = new int?(base.CurrentUser.UserID),
         ReaderIsDel = false,
         ReceiverIsRead = false,
         SenderIsDel = false,
         ReceiverID = new int?(ReceiverID),
         SendTime = new DateTime?(DateTime.Now)
     };
     if (this.bllSM.Add(model) > 0)
     {
         obj2.Accumulate("STATUS", "SUCC");
     }
     else
     {
         obj2.Accumulate("STATUS", "FAIL");
     }
     base.Response.Write(obj2.ToString());
 }
 public void DelReceiveMsg(int MsgID)
 {
     JsonObject obj2 = new JsonObject();
     if (this.bllSM.SetReceiveMsgToDelById(MsgID) > 0)
     {
         obj2.Accumulate("STATUS", "SUCC");
     }
     else
     {
         obj2.Accumulate("STATUS", "FAIL");
     }
     base.Response.Write(obj2.ToString());
 }
 public void CheckPassword(FormCollection collection)
 {
     JsonObject obj2 = new JsonObject();
     string str = collection["Password"];
     if (!string.IsNullOrWhiteSpace(str))
     {
         SiteIdentity identity = new SiteIdentity(base.CurrentUser.UserName);
         if (identity.TestPassword(str.Trim()) == 0)
         {
             obj2.Accumulate("STATUS", "ERROR");
         }
         else
         {
             obj2.Accumulate("STATUS", "OK");
         }
     }
     else
     {
         obj2.Accumulate("STATUS", "UNDEFINED");
     }
     base.Response.Write(obj2.ToString());
 }
 public void CheckNickName(FormCollection collection)
 {
     JsonObject obj2 = new JsonObject();
     if ((base.HttpContext.User.Identity.IsAuthenticated && (base.CurrentUser != null)) && (base.CurrentUser.UserType != "AA"))
     {
         string str = collection["NickName"];
         if (!string.IsNullOrWhiteSpace(str))
         {
             Maticsoft.BLL.Members.Users users = new Maticsoft.BLL.Members.Users();
             if (users.ExistsNickName(base.CurrentUser.UserID, str))
             {
                 obj2.Accumulate("STATUS", "EXISTS");
             }
             else
             {
                 obj2.Accumulate("STATUS", "OK");
             }
         }
         else
         {
             obj2.Accumulate("STATUS", "NOTNULL");
         }
         base.Response.Write(obj2.ToString());
     }
     else
     {
         obj2.Accumulate("STATUS", "NOTNULL");
         base.Response.Write(obj2.ToString());
     }
 }
 public void UpdateUserInfo(FormCollection collection)
 {
     if ((!base.HttpContext.User.Identity.IsAuthenticated || (base.CurrentUser == null)) || (base.CurrentUser.UserType == "AA"))
     {
         this.RedirectToAction(((dynamic) base.ViewBag).BasePath + "Account/Login");
     }
     else
     {
         JsonObject obj2 = new JsonObject();
         UsersExpModel usersModel = this.userEXBll.GetUsersModel(base.CurrentUser.UserID);
         if (usersModel == null)
         {
             base.RedirectToAction("Login", "Account");
         }
         else
         {
             usersModel.TelPhone = collection["TelPhone"];
             string str = collection["Birthday"];
             if (!string.IsNullOrWhiteSpace(str) && PageValidate.IsDateTime(str))
             {
                 usersModel.Birthday = new DateTime?(Globals.SafeDateTime(str, DateTime.Now));
             }
             else
             {
                 usersModel.Birthday = null;
             }
             usersModel.Constellation = collection["Constellation"];
             usersModel.PersonalStatus = collection["PersonalStatus"];
             usersModel.Singature = collection["Singature"];
             usersModel.Address = collection["Address"];
             User user = new User(base.CurrentUser.UserID) {
                 Sex = collection["Sex"],
                 Email = collection["Email"],
                 NickName = collection["NickName"],
                 Phone = collection["Phone"]
             };
             if (user.Update() && this.userEXBll.UpdateUsersExp(usersModel))
             {
                 obj2.Accumulate("STATUS", "SUCC");
             }
             else
             {
                 obj2.Accumulate("STATUS", "FAIL");
             }
             base.Response.Write(obj2.ToString());
         }
     }
 }
Exemple #50
0
 private void GetTaoBaoParentNode(HttpContext context)
 {
     int categoryId = Globals.SafeInt(context.Request.Params["NodeId"], 0);
     JsonObject obj2 = new JsonObject();
     DataSet set = this.taoBaoCateBll.GetList("");
     if ((set != null) && (set.Tables.Count > 0))
     {
         DataTable table = set.Tables[0];
         Maticsoft.Model.SNS.CategorySource model = this.taoBaoCateBll.GetModel(3, categoryId);
         if (model != null)
         {
             string[] strArray = model.Path.TrimEnd(new char[] { '|' }).Split(new char[] { '|' });
             if (strArray.Length > 0)
             {
                 List<DataRow[]> list = new List<DataRow[]>();
                 for (int i = 0; i <= strArray.Length; i++)
                 {
                     DataRow[] item = null;
                     if (i == 0)
                     {
                         item = table.Select("ParentId=0");
                     }
                     else
                     {
                         item = table.Select("ParentId=" + strArray[i - 1]);
                     }
                     if (item.Length > 0)
                     {
                         list.Add(item);
                     }
                 }
                 obj2.Accumulate("STATUS", "OK");
                 obj2.Accumulate("DATA", list);
                 obj2.Accumulate("PARENT", strArray);
             }
             else
             {
                 obj2.Accumulate("STATUS", "NODATA");
                 context.Response.Write(obj2.ToString());
                 return;
             }
         }
     }
     context.Response.Write(obj2.ToString());
 }
Exemple #51
0
 private void GetTaoBaoDepthNode(HttpContext context)
 {
     List<Maticsoft.Model.SNS.CategorySource> categorysByDepth;
     JsonArray data;
     int categoryId = Globals.SafeInt(context.Request.Params["NodeId"], 0);
     JsonObject obj2 = new JsonObject();
     if (categoryId > 0)
     {
         Maticsoft.Model.SNS.CategorySource model = this.taoBaoCateBll.GetModel(3, categoryId);
         categorysByDepth = this.taoBaoCateBll.GetCategorysByDepth(model.Depth);
     }
     else
     {
         categorysByDepth = this.taoBaoCateBll.GetCategorysByDepth(1);
     }
     if (categorysByDepth.Count < 1)
     {
         obj2.Accumulate("STATUS", "NODATA");
         context.Response.Write(obj2.ToString());
     }
     else
     {
         obj2.Accumulate("STATUS", "OK");
         data = new JsonArray();
         categorysByDepth.ForEach(delegate (Maticsoft.Model.SNS.CategorySource info) {
             data.Add(new JsonObject(new string[] { "ClassID", "ClassName" }, new object[] { info.CategoryId, info.Name }));
         });
         obj2.Accumulate("DATA", data);
         context.Response.Write(obj2.ToString());
     }
 }
Exemple #52
0
 private void GetTaoBaoChildNode(HttpContext context)
 {
     string text = context.Request.Params["ParentId"];
     JsonObject obj2 = new JsonObject();
     int parentCategoryId = Globals.SafeInt(text, 0);
     DataSet categorysByParentId = this.taoBaoCateBll.GetCategorysByParentId(parentCategoryId);
     if (categorysByParentId.Tables[0].Rows.Count < 1)
     {
         obj2.Accumulate("STATUS", "NODATA");
         context.Response.Write(obj2.ToString());
     }
     else
     {
         obj2.Accumulate("STATUS", "OK");
         obj2.Accumulate("DATA", categorysByParentId.Tables[0]);
         context.Response.Write(obj2.ToString());
     }
 }
 public void UpdateUserPassword(FormCollection collection)
 {
     if (!base.HttpContext.User.Identity.IsAuthenticated || (base.CurrentUser == null))
     {
         this.RedirectToAction(((dynamic) base.ViewBag).BasePath + "Account/Login");
     }
     else
     {
         JsonObject obj2 = new JsonObject();
         string str = collection["NewPassword"];
         string str2 = collection["ConfirmPassword"];
         if (!string.IsNullOrWhiteSpace(str) && !string.IsNullOrWhiteSpace(str2))
         {
             if (str.Trim() != str2.Trim())
             {
                 obj2.Accumulate("STATUS", "FAIL");
             }
             else
             {
                 base.currentUser.Password = AccountsPrincipal.EncryptPassword(str);
                 if (base.currentUser.Update())
                 {
                     obj2.Accumulate("STATUS", "UPDATESUCC");
                 }
                 else
                 {
                     obj2.Accumulate("STATUS", "UPDATEFAIL");
                 }
             }
         }
         else
         {
             obj2.Accumulate("STATUS", "UNDEFINED");
         }
         base.Response.Write(obj2.ToString());
     }
 }
 public void UpdateUserInfo(FormCollection collection)
 {
     JsonObject obj2 = new JsonObject();
     UsersExpModel usersModel = this.userEXBll.GetUsersModel(base.CurrentUser.UserID);
     usersModel.TelPhone = collection["TelPhone"];
     string str = collection["Birthday"];
     if (!string.IsNullOrWhiteSpace(str) && PageValidate.IsDateTime(str))
     {
         usersModel.Birthday = new DateTime?(Globals.SafeDateTime(str, DateTime.Now));
     }
     else
     {
         usersModel.Birthday = null;
     }
     usersModel.Constellation = collection["Constellation"];
     usersModel.PersonalStatus = collection["PersonalStatus"];
     usersModel.Singature = collection["Singature"];
     usersModel.Address = collection["Address"];
     User user = new User(base.CurrentUser.UserID) {
         Sex = collection["Sex"],
         Email = collection["Email"],
         NickName = collection["NickName"],
         Phone = collection["Phone"]
     };
     if (user.Update() && this.userEXBll.UpdateUsersExp(usersModel))
     {
         obj2.Accumulate("STATUS", "SUCC");
     }
     else
     {
         obj2.Accumulate("STATUS", "FAIL");
     }
     base.Response.Write(obj2.ToString());
 }
 public void ExistsNickName(FormCollection collection)
 {
     if (!base.HttpContext.User.Identity.IsAuthenticated || (base.CurrentUser == null))
     {
         this.RedirectToAction(((dynamic) base.ViewBag).BasePath + "Account/Login");
     }
     else
     {
         JsonObject obj2 = new JsonObject();
         string str = collection["NickName"];
         if (!string.IsNullOrWhiteSpace(str))
         {
             Maticsoft.BLL.Members.Users users = new Maticsoft.BLL.Members.Users();
             if (users.ExistsNickName(str))
             {
                 obj2.Accumulate("STATUS", "EXISTS");
             }
             else
             {
                 obj2.Accumulate("STATUS", "NOTEXISTS");
             }
         }
         else
         {
             obj2.Accumulate("STATUS", "NOTNULL");
         }
         base.Response.Write(obj2.ToString());
     }
 }
 public void CheckPassword(FormCollection collection)
 {
     if (!base.HttpContext.User.Identity.IsAuthenticated || (base.CurrentUser == null))
     {
         this.RedirectToAction(((dynamic) base.ViewBag).BasePath + "Account/Login");
     }
     else
     {
         JsonObject obj2 = new JsonObject();
         string str = collection["Password"];
         if (!string.IsNullOrWhiteSpace(str))
         {
             SiteIdentity identity = new SiteIdentity(base.CurrentUser.UserName);
             if (identity.TestPassword(str.Trim()) == 0)
             {
                 obj2.Accumulate("STATUS", "ERROR");
             }
             else
             {
                 obj2.Accumulate("STATUS", "OK");
             }
         }
         else
         {
             obj2.Accumulate("STATUS", "UNDEFINED");
         }
         base.Response.Write(obj2.ToString());
     }
 }
 public void UpdateUserPassword(FormCollection collection)
 {
     JsonObject obj2 = new JsonObject();
     string str = collection["NewPassword"];
     string str2 = collection["ConfirmPassword"];
     if (!string.IsNullOrWhiteSpace(str) && !string.IsNullOrWhiteSpace(str2))
     {
         if (str.Trim() != str2.Trim())
         {
             obj2.Accumulate("STATUS", "FAIL");
         }
         else
         {
             base.currentUser.Password = AccountsPrincipal.EncryptPassword(str);
             if (base.currentUser.Update())
             {
                 obj2.Accumulate("STATUS", "UPDATESUCC");
             }
             else
             {
                 obj2.Accumulate("STATUS", "UPDATEFAIL");
             }
         }
     }
     else
     {
         obj2.Accumulate("STATUS", "UNDEFINED");
     }
     base.Response.Write(obj2.ToString());
 }
 private void SetCategory(HttpContext context)
 {
     int productId = Globals.SafeInt(context.Request.Params["ProductId"], 0);
     int cateId = Globals.SafeInt(context.Request.Params["CategoryId"], 0);
     JsonObject obj2 = new JsonObject();
     if (((productId > 0) && (cateId > 0)) && this.ProductsBll.UpdateEX(productId, cateId))
     {
         obj2.Accumulate("STATUS", "OK");
     }
     context.Response.Write(obj2.ToString());
 }
 private void GetSNSProductNodes(HttpContext context)
 {
     JsonArray data;
     Globals.SafeInt(context.Request.Params["NodeId"], 0);
     JsonObject obj2 = new JsonObject();
     this.CategoriesList = new List<Maticsoft.Model.SNS.Categories>();
     List<Maticsoft.Model.SNS.Categories> categorysByDepth = this.SNSCateBll.GetCategorysByDepth(1, 0);
     if (categorysByDepth.Count < 1)
     {
         obj2.Accumulate("STATUS", "NODATA");
         context.Response.Write(obj2.ToString());
     }
     else
     {
         foreach (Maticsoft.Model.SNS.Categories categories in categorysByDepth)
         {
             categories.Name = "╋" + categories.Name;
             this.CategoriesList.Add(categories);
             string blank = "├";
             this.BindNode(categories.CategoryId, blank);
         }
         obj2.Accumulate("STATUS", "OK");
         data = new JsonArray();
         this.CategoriesList.ForEach(delegate (Maticsoft.Model.SNS.Categories info) {
             data.Add(new JsonObject(new string[] { "ClassID", "ClassName" }, new object[] { info.CategoryId, info.Name }));
         });
         obj2.Accumulate("DATA", data);
         context.Response.Write(obj2.ToString());
     }
 }
Exemple #60
0
 private void GetPackageNode(HttpContext context)
 {
     Maticsoft.BLL.Shop.Package.Package package = new Maticsoft.BLL.Shop.Package.Package();
     int num = Globals.SafeInt(context.Request.Params["id"], 0);
     string str = context.Request.Params["q"];
     JsonObject obj2 = new JsonObject();
     StringBuilder builder = new StringBuilder();
     if (num > 0)
     {
         builder.Append(" CategoryId =" + num);
     }
     if (!string.IsNullOrEmpty(str))
     {
         if (builder.Length > 0)
         {
             builder.Append(" and ");
         }
         builder.Append(" Name like '%" + str + "%'");
     }
     DataSet list = null;
     if (builder.Length > 0)
     {
         list = package.GetList(builder.ToString());
     }
     if ((list == null) || (list.Tables[0].Rows.Count < 1))
     {
         obj2.Accumulate("STATUS", "NODATA");
         context.Response.Write(obj2.ToString());
     }
     else
     {
         obj2.Accumulate("STATUS", "OK");
         obj2.Accumulate("DATA", list.Tables[0]);
         context.Response.Write(obj2.ToString());
     }
 }