示例#1
0
        private string submitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessWorkPlace bc = new project.Business.Base.BusinessWorkPlace();
                if (jp.getValue("tp") == "update")
                {
                    bc.load(jp.getValue("id"));
                    bc.Entity.WPType       = jp.getValue("WPType");
                    bc.Entity.WPSeat       = ParseIntForString(jp.getValue("WPSeat"));
                    bc.Entity.WPSeatPrice  = ParseDecimalForString(jp.getValue("WPSeatPrice"));
                    bc.Entity.WPLOCNo1     = jp.getValue("WPLOCNo1");
                    bc.Entity.WPLOCNo2     = jp.getValue("WPLOCNo2");
                    bc.Entity.WPLOCNo3     = jp.getValue("WPLOCNo3");
                    bc.Entity.WPLOCNo4     = jp.getValue("WPLOCNo4");
                    bc.Entity.WPRMID       = jp.getValue("WPRMID");
                    bc.Entity.WPProject    = jp.getValue("WPProject");
                    bc.Entity.WPAddr       = jp.getValue("WPAddr");
                    bc.Entity.IsStatistics = bool.Parse(jp.getValue("IsStatistics"));
                    int r = bc.Save("update");

                    if (r <= 0)
                    {
                        flag = "2";
                    }
                    else
                    {
                        collection.Add(new JsonStringValue("ZYSync", bc.SyncResource("au")));
                    }
                }
                else
                {
                    Data      obj = new Data();
                    DataTable dt  = obj.PopulateDataSet("select cnt=COUNT(*) from Mstr_WorkPlace where WPNo='" + jp.getValue("WPNo") + "'").Tables[0];
                    if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0)
                    {
                        flag = "3";
                    }
                    else
                    {
                        bc.Entity.WPNo         = jp.getValue("WPNo");
                        bc.Entity.WPType       = jp.getValue("WPType");
                        bc.Entity.WPSeat       = ParseIntForString(jp.getValue("WPSeat"));
                        bc.Entity.WPSeatPrice  = ParseDecimalForString(jp.getValue("WPSeatPrice"));
                        bc.Entity.WPLOCNo1     = jp.getValue("WPLOCNo1");
                        bc.Entity.WPLOCNo2     = jp.getValue("WPLOCNo2");
                        bc.Entity.WPLOCNo3     = jp.getValue("WPLOCNo3");
                        bc.Entity.WPLOCNo4     = jp.getValue("WPLOCNo4");
                        bc.Entity.WPRMID       = jp.getValue("WPRMID");
                        bc.Entity.WPProject    = jp.getValue("WPProject");
                        bc.Entity.WPAddr       = jp.getValue("WPAddr");
                        bc.Entity.IsStatistics = bool.Parse(jp.getValue("IsStatistics"));
                        bc.Entity.WPCreator    = user.Entity.UserName;
                        bc.Entity.WPCreateDate = GetDate();

                        int r = bc.Save("insert");
                        if (r <= 0)
                        {
                            flag = "2";
                        }
                        else
                        {
                            collection.Add(new JsonStringValue("ZYSync", bc.SyncResource("au")));
                        }
                    }
                }
            }
            catch { flag = "2"; }


            collection.Add(new JsonStringValue("type", "submit"));
            collection.Add(new JsonStringValue("flag", flag));
            collection.Add(new JsonStringValue("liststr", createList(jp.getValue("WPNoS"), jp.getValue("WPTypeS"), jp.getValue("WPLOCNo1S"), jp.getValue("WPLOCNo2S"),
                                                                     jp.getValue("WPLOCNo3S"), jp.getValue("WPLOCNo4S"), jp.getValue("WPRMIDS"), jp.getValue("WPStatusS"), ParseIntForString(jp.getValue("page")))));

            return(collection.ToString());
        }
示例#2
0
        private string submitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessWorkPlace bc = new project.Business.Base.BusinessWorkPlace();
                if (jp.getValue("tp") == "update")
                {
                    bc.load(jp.getValue("id"));
                    bc.Entity.WPType       = jp.getValue("WPType");
                    bc.Entity.WPSeat       = ParseIntForString(jp.getValue("WPSeat"));
                    bc.Entity.WPSeatPrice  = ParseDecimalForString(jp.getValue("WPSeatPrice"));
                    bc.Entity.WPLOCNo1     = jp.getValue("WPLOCNo1");
                    bc.Entity.WPLOCNo2     = jp.getValue("WPLOCNo2");
                    bc.Entity.WPLOCNo3     = jp.getValue("WPLOCNo3");
                    bc.Entity.WPLOCNo4     = jp.getValue("WPLOCNo4");
                    bc.Entity.WPRMID       = jp.getValue("WPRMID");
                    bc.Entity.WPProject    = jp.getValue("WPProject");
                    bc.Entity.WPAddr       = jp.getValue("WPAddr");
                    bc.Entity.IsStatistics = bool.Parse(jp.getValue("IsStatistics"));
                    int r = bc.Save("update");

                    if (r <= 0)
                    {
                        flag = "2";
                    }
                    else
                    {
                        #region  步到资源系统

                        string syncResult = string.Empty;
                        try
                        {
                            ResourceService.ResourceService srv = new ResourceService.ResourceService();
                            srv.Url    = ConfigurationManager.AppSettings["ResourceServiceUrl"].ToString();
                            syncResult = srv.AddOrUpdateWorkPlace(JsonConvert.SerializeObject(bc.Entity));
                        }
                        catch (Exception ex)
                        {
                            syncResult = ex.ToString();
                        }
                        collection.Add(new JsonStringValue("sync", syncResult));

                        #endregion
                    }
                }
                else
                {
                    Data      obj = new Data();
                    DataTable dt  = obj.PopulateDataSet("select cnt=COUNT(*) from Mstr_WorkPlace where WPNo='" + jp.getValue("WPNo") + "'").Tables[0];
                    if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0)
                    {
                        flag = "3";
                    }
                    else
                    {
                        bc.Entity.WPNo         = jp.getValue("WPNo");
                        bc.Entity.WPType       = jp.getValue("WPType");
                        bc.Entity.WPSeat       = ParseIntForString(jp.getValue("WPSeat"));
                        bc.Entity.WPSeatPrice  = ParseDecimalForString(jp.getValue("WPSeatPrice"));
                        bc.Entity.WPLOCNo1     = jp.getValue("WPLOCNo1");
                        bc.Entity.WPLOCNo2     = jp.getValue("WPLOCNo2");
                        bc.Entity.WPLOCNo3     = jp.getValue("WPLOCNo3");
                        bc.Entity.WPLOCNo4     = jp.getValue("WPLOCNo4");
                        bc.Entity.WPRMID       = jp.getValue("WPRMID");
                        bc.Entity.WPProject    = jp.getValue("WPProject");
                        bc.Entity.WPAddr       = jp.getValue("WPAddr");
                        bc.Entity.IsStatistics = bool.Parse(jp.getValue("IsStatistics"));
                        bc.Entity.WPCreator    = user.Entity.UserName;
                        bc.Entity.WPCreateDate = GetDate();

                        int r = bc.Save("insert");
                        if (r <= 0)
                        {
                            flag = "2";
                        }
                        else
                        {
                            #region  步到资源系统

                            string syncResult = string.Empty;
                            try
                            {
                                ResourceService.ResourceService srv = new ResourceService.ResourceService();
                                srv.Url    = ConfigurationManager.AppSettings["ResourceServiceUrl"].ToString();
                                syncResult = srv.AddOrUpdateWorkPlace(JsonConvert.SerializeObject(bc.Entity));
                            }
                            catch (Exception ex)
                            {
                                syncResult = ex.ToString();
                            }
                            collection.Add(new JsonStringValue("sync", syncResult));

                            #endregion
                        }
                    }
                }
            }
            catch { flag = "2"; }


            collection.Add(new JsonStringValue("type", "submit"));
            collection.Add(new JsonStringValue("flag", flag));
            collection.Add(new JsonStringValue("liststr", createList(jp.getValue("WPNoS"), jp.getValue("WPTypeS"), jp.getValue("WPLOCNo1S"), jp.getValue("WPLOCNo2S"),
                                                                     jp.getValue("WPLOCNo3S"), jp.getValue("WPLOCNo4S"), jp.getValue("WPRMIDS"), jp.getValue("WPStatusS"), ParseIntForString(jp.getValue("page")))));

            return(collection.ToString());
        }