コード例 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            // add org user
            string strParmaInfo = "";

            GlareLedServices2.GLSysMgrSoapClient cl = new GlareLedServices2.GLSysMgrSoapClient();

            OrgUser userMod = new OrgUser()
            {
                Id       = 0,
                MgrOrgId = 1,
                Name     = "orgname",
                Password = "******"
            };
            string strInfo = JsonStrObjConver.Obj2JsonStr(userMod, typeof(OrgUser));

            RequestModelString obj2 = new RequestModelString()
            {
                Info   = strInfo,
                reqDt  = DateTime.Now,
                TockId = ConstDefineTestWebapi.TockIdEnableTest
            };

            strParmaInfo = JsonStrObjConver.Obj2JsonStr(obj2, typeof(RequestModelString));
            string strResult = cl.AddOrgUser(strParmaInfo);

            MessageBox.Show(strResult);
        }
コード例 #2
0
        /// <summary>
        /// 构造请求头,获取请求头的基础数据
        /// </summary>
        /// <param name="callbackparam"></param>
        /// <param name="paramjson"></param>
//         public static void MakeHead(out string callbackparam,
//             out string paramjson,
//             out string paramUUID,
//             out string paramDt)
//         {
//             HttpContext.Current.Response.ContentType = ConstDefine.ParamHead;
//             callbackparam = HttpContext.Current.Request.Params[ConstDefine.JsonCallBakcParam].ToString();
//             paramjson = HttpContext.Current.Request.Params[ConstDefine.ParamName].ToString();
//             paramUUID = HttpContext.Current.Request.Params[ConstDefine.ParamUUID].ToString();
//             paramDt = HttpContext.Current.Request.Params[ConstDefine.ParamDt].ToString();
//         }



        /// <summary>
        /// 构造请求头,获取请求头的基础数据
        /// </summary>
        /// <param name="callbackparam"></param>
        /// <param name="paramjson"></param>
        public static void MakeHead(out string callbackparam,
                                    out string paramjson)
        {
            string strTockId;
            string paramDt;
            string strInfo;

            HttpContext.Current.Response.ContentType = ConstDefineWs.ParamHead;
            callbackparam = HttpContext.Current.Request.Params[ConstDefineWs.JsonCallBakcParam].ToString();
            strInfo       = HttpContext.Current.Request.Params[ConstDefineWs.ParamName].ToString();
            strTockId     = HttpContext.Current.Request.Params[ConstDefineWs.ParamTockId].ToString();
            paramDt       = HttpContext.Current.Request.Params[ConstDefineWs.ParamDt].ToString();


            DateTime dt;

            DateTime.TryParse(paramDt, out dt);
            RequestModelString reqmod = new RequestModelString()
            {
                Info   = strInfo,
                reqDt  = dt,
                TockId = strTockId
            };

            paramjson = JsonStrObjConver.Obj2JsonStr(reqmod, typeof(RequestModelString));
        }
コード例 #3
0
        private void button14_Click(object sender, EventArgs e)
        {
            // add group
            GroupInfo mod = new GroupInfo()
            {
                GroupAddress = "添加测试地址",
                ManageName   = "manager name",
                Id           = 0,
                ManageTel    = "telnon...123456",
                GroupName    = "newgroupname",
                OrgId        = 1
            };

            RequestModelString obj = new RequestModelString()
            {
                Info   = JsonStrObjConver.Obj2JsonStr(mod, typeof(GroupInfo)),
                reqDt  = DateTime.Now,
                TockId = ConstDefineTestWebapi.TockIdEnableTest
            };

            string strParmaInfo = JsonStrObjConver.Obj2JsonStr(obj, typeof(RequestModelString));

            GlareLedServices2.GLSysMgrSoapClient cl = new GlareLedServices2.GLSysMgrSoapClient();

            string strResult = cl.AddGroup(strParmaInfo);

            MessageBox.Show(strResult);
        }
コード例 #4
0
        private void button15_Click(object sender, EventArgs e)
        {
            // add project
            ProjectInfo mod = new ProjectInfo()
            {
                Id          = 0,
                Address     = "address",
                GroupId     = 1,
                ManagerName = "manager",
                ManagerTel  = "tel 000111",
                OrgId       = 1,
                ProjectName = "project name"
            };

            RequestModelString obj = new RequestModelString()
            {
                Info   = JsonStrObjConver.Obj2JsonStr(mod, typeof(ProjectInfo)),
                reqDt  = DateTime.Now,
                TockId = ConstDefineTestWebapi.TockIdEnableTest
            };

            string strParmaInfo = JsonStrObjConver.Obj2JsonStr(obj, typeof(RequestModelString));

            GlareLedServices2.GLSysMgrSoapClient cl = new GlareLedServices2.GLSysMgrSoapClient();

            string strResult = cl.AddProject(strParmaInfo);

            MessageBox.Show(strResult);
        }
コード例 #5
0
        public string GetAllCards(string strJsonParam)
        {
            string             strError;
            RequestModelString reqinfo = ServerHlper.GetRequestModelString(System.Reflection.MethodBase.GetCurrentMethod().Name,
                                                                           strJsonParam, out strError);

            if (reqinfo == null)
            {
                return(strError);
            }

            List <GasCardWithCommInfo> lsts = CardWithCommDevBll.GetAllDevList();

            if (lsts == null)
            {
                return(ServerHlper.MakeInfoByStatus(false, ConstDefineWs.LoginNameOrPassword));
            }

            // 成功返回成功标志及新增加的ID
            JsonResutlModelString result = new JsonResutlModelString()
            {
                ErrorDesc = "success",
                Info      = JsonStrObjConver.Obj2JsonStr(lsts, typeof(List <GasCardWithCommInfo>)),
                Status    = true,
                StatusInt = 1
            };

            return(JsonStrObjConver.Obj2JsonStr(result, typeof(JsonResutlModelString)));
        }
コード例 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            string strParmaInfo = "";

            GlareLedServices2.GLSysMgrSoapClient cl = new GlareLedServices2.GLSysMgrSoapClient();

            SuperUser userMod = new SuperUser()
            {
                Id         = 0,
                EnableTime = DateTime.Now,
                UserType   = 0,
                Name       = "bbb",
                Password   = "******"
            };
            string strInfo = JsonStrObjConver.Obj2JsonStr(userMod, typeof(SuperUser));

            RequestModelString obj2 = new RequestModelString()
            {
                Info   = strInfo,
                reqDt  = DateTime.Now,
                TockId = ConstDefineTestWebapi.TockIdEnableTest
            };

            strParmaInfo = JsonStrObjConver.Obj2JsonStr(obj2, typeof(RequestModelString));
            string strResult = cl.AddSuperUser(strParmaInfo);

            MessageBox.Show(strResult);
        }
コード例 #7
0
        public string OrgLogin(string strJsonParam)
        {
            RequestModelString reqinfo = JsonStrObjConver.JsonStr2Obj(strJsonParam, typeof(RequestModelString))
                                         as RequestModelString;

            if (reqinfo == null)
            {
                return(ServerHlper.MakeInfoByStatus(false, ConstDefineWs.HttpParamError));
            }

            LoginNamePassModel mod = JsonStrObjConver.JsonStr2Obj(reqinfo.Info, typeof(LoginNamePassModel))
                                     as LoginNamePassModel;

            if (reqinfo == null)
            {
                return(ServerHlper.MakeInfoByStatus(false, ConstDefineWs.HttpParamError));
            }

            OrgLoginedUserModel userInfo = LoginBll.OrgLogin(mod.UserName, mod.Password);

            if (userInfo != null)
            {
                JsonResutlModelString result = new JsonResutlModelString()
                {
                    ErrorDesc = "success",
                    Info      = JsonStrObjConver.Obj2JsonStr(userInfo, typeof(OrgLoginedUserModel)),
                    Status    = true,
                    StatusInt = 1
                };

                return(JsonStrObjConver.Obj2JsonStr(result, typeof(JsonResutlModelString)));
            }
            return(ServerHlper.MakeInfoByStatus(false, ConstDefineWs.LoginNameOrPassword));
        }
コード例 #8
0
        public string AddGroupUser(string strParams)
        {
            string             strError;
            RequestModelString reqinfo = ServerHlper.GetRequestModelString(System.Reflection.MethodBase.GetCurrentMethod().Name,
                                                                           strParams, out strError);

            if (reqinfo == null)
            {
                return(strError);
            }

            if (!LoginBll.CheckLoginId(reqinfo.TockId))
            {
                return(ServerHlper.MakeInfoByStatus(false, ConstDefineWs.LoginInfoError));
            }

            GroupUser mod = JsonStrObjConver.JsonStr2Obj(reqinfo.Info, typeof(GroupUser)) as GroupUser;

            if (mod == null)
            {
                return(ServerHlper.MakeInfoByStatus(false, ConstDefineWs.HttpParamError));
            }

            if (GroupUserBll.IsNameExist(mod.Name))
            {
                return(ServerHlper.MakeInfoByStatus(false, ConstDefineBll.NameExist));
            }
            bool result = GroupUserBll.AddUser(ref mod, out strError);

            return(ServerHlper.MakeInfoByStatus(result, strError));
        }
コード例 #9
0
        public string AddSuperUser(string strParams)
        {
            string             strError;
            RequestModelString reqinfo = ServerHlper.GetRequestModelString(System.Reflection.MethodBase.GetCurrentMethod().Name,
                                                                           strParams, out strError);

            if (reqinfo == null)
            {
                return(strError);
            }

            SuperUser mod = JsonStrObjConver.JsonStr2Obj(reqinfo.Info, typeof(SuperUser))
                            as SuperUser;

            if (mod == null)
            {
                return(ServerHlper.MakeInfoByStatus(false, "需要添加的用户参数不对"));
            }

            if (SuperUserBll.IsUserNameExist(mod.Name))
            {
                return(ServerHlper.MakeInfoByStatus(false, "需要添加的用户名已经存在"));
            }
            bool result = SuperUserBll.AddUser(ref mod, out strError);

            return(ServerHlper.MakeInfoByStatus(result, strError));
        }
コード例 #10
0
        public string Logout(string strJsonParam)
        {
            RequestModelString reqinfo = JsonStrObjConver.JsonStr2Obj(strJsonParam, typeof(RequestModelString))
                                         as RequestModelString;

            if (reqinfo == null)
            {
                return(ServerHlper.MakeInfoByStatus(false, ConstDefineWs.HttpParamError));
            }

            LoginBll.Logout(reqinfo.TockId);
            return(ServerHlper.MakeInfoByStatus(true, "success"));
        }
コード例 #11
0
        public string UpdateLoginTimeByUuid(string strJsonParam)
        {
            RequestModelString reqinfo = JsonStrObjConver.JsonStr2Obj(strJsonParam, typeof(RequestModelString))
                                         as RequestModelString;

            if (reqinfo == null)
            {
                return(ServerHlper.MakeInfoByStatus(false, "刷新登录信息,参数不对"));
            }

            bool bRsult = true;

            LoginBll.UpdateLoginStatus(reqinfo.TockId);
            return(ServerHlper.MakeInfoByStatus(bRsult, bRsult.ToString()));
        }
コード例 #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="strFun">函数名</param>
        /// <param name="strJsonParam"></param>
        /// <param name="strErrorString"></param>
        /// <returns></returns>
        public static RequestModelString GetRequestModelString(string strFun, string strJsonParam,
                                                               out string strErrorString)
        {
            strErrorString = "";
            RequestModelString reqinfo = JsonStrObjConver.JsonStr2Obj(strJsonParam, typeof(RequestModelString))
                                         as RequestModelString;

            if (reqinfo == null)
            {
                strErrorString = MakeInfoByStatus(false,
                                                  string.Format("{0}_{1}", ConstDefineWs.WebMethodParamError, strFun));
                return(null);
            }

            if (!LoginUserEnableMgr.Get().IsLoginIdEnable(reqinfo.TockId))
            {
                strErrorString = MakeInfoByStatus(false,
                                                  string.Format("{0}_{1}", ConstDefineWs.LoginInfoError, strFun));
            }

            return(reqinfo);
        }
コード例 #13
0
        public string DelADevById(string strJsonParam)
        {
            string             strError;
            RequestModelString reqinfo = ServerHlper.GetRequestModelString(System.Reflection.MethodBase.GetCurrentMethod().Name,
                                                                           strJsonParam, out strError);

            if (reqinfo == null)
            {
                return(strError);
            }

            int id = 0;

            int.TryParse(reqinfo.Info, out id);

            if (id <= 0)
            {
                return(ServerHlper.MakeInfoByStatus(false, ConstDefineWs.HttpParamError));
            }

            bool bResult = CardWithCommDevBll.DelDev(id);

            if (!bResult)
            {
                return(ServerHlper.MakeInfoByStatus(false, ConstDefineWs.LoginNameOrPassword));
            }

            // 成功返回成功标志及新增加的ID
            JsonResutlModelString result = new JsonResutlModelString()
            {
                ErrorDesc = "success",
                Info      = id.ToString(),
                Status    = true,
                StatusInt = 1
            };

            return(JsonStrObjConver.Obj2JsonStr(result, typeof(JsonResutlModelString)));
        }
コード例 #14
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            LoginNamePassModel mod = new LoginNamePassModel()
            {
                UserName = "******",       // 只有这个有意义
                Password = "******",       // 只有这个有意义
            };

            RequestModelString obj = new RequestModelString()
            {
                Info   = JsonStrObjConver.Obj2JsonStr(mod, typeof(LoginNamePassModel)),
                reqDt  = DateTime.Now,
                TockId = ConstDefineTestWebapi.TockIdEnableTest
            };

            string strParmaInfo = JsonStrObjConver.Obj2JsonStr(obj, typeof(RequestModelString));

            GlareLedServices2.GLSysMgrSoapClient cl = new GlareLedServices2.GLSysMgrSoapClient();

            string strResult = cl.SuperLogin(strParmaInfo);

            MessageBox.Show(strResult);
        }
コード例 #15
0
        public string AddProject(string strParams)
        {
            string             strError;
            RequestModelString reqinfo = ServerHlper.GetRequestModelString(System.Reflection.MethodBase.GetCurrentMethod().Name,
                                                                           strParams, out strError);

            if (reqinfo == null)
            {
                return(strError);
            }

            ProjectInfo mod = JsonStrObjConver.JsonStr2Obj(reqinfo.Info, typeof(ProjectInfo))
                              as ProjectInfo;

            if (mod == null)
            {
                return(ServerHlper.MakeInfoByStatus(false, ConstDefineWs.HttpParamError));
            }

            bool bResult = ProjectBll.AddAProject(ref mod, out strError);

            if (!bResult)
            {
                return(ServerHlper.MakeInfoByStatus(false, ConstDefineWs.LoginNameOrPassword));
            }

            // 成功返回成功标志及新增加的ID
            JsonResutlModelString result = new JsonResutlModelString()
            {
                ErrorDesc = "success",
                Info      = mod.Id.ToString(),
                Status    = true,
                StatusInt = 1
            };

            return(JsonStrObjConver.Obj2JsonStr(result, typeof(JsonResutlModelString)));
        }
コード例 #16
0
        private void button19_Click(object sender, EventArgs e)
        {
            GasCardWithCommInfo mod = new GasCardWithCommInfo()
            {
                Id                = 0,
                Name              = "CardName",
                Address           = "",
                BEnable           = 1,
                CardBrightness    = 1,
                CardIsDouble      = 1,
                CardNumberCount   = 1,
                CardPointCount    = 1,
                CardScreenCount   = 6,
                CityId            = "",
                Comment           = "",
                CommExtConnInfo   = "",
                CommSerialBaud    = 0,
                CommSerialDataBit = 0,
                CommSerialParity  = 0,
                CommSerialPort    = "",
                CommSerialStopBit = 0,
                CommServerIp      = "",
                CommServerPort    = 0,
                CommServerSn      = "sn00006",
                CommTimeoutMs     = 2000,
                CommType          = 1,
                DefName           = "defname003",
                DefPassword       = "******",
                IsDel             = 0,
                Password          = "******",
                PosLatitude       = "",
                PosLongitude      = "",
                ProtocolType      = 0,

                CardModel = "GL-88888-910",

                ProjectId   = 1,
                GroupId     = 1,
                OrgId       = 1,
                CardContext = "1111-1111-111-111-11-11-11-11-11-11-11-11-11",
                ScreenNams  = "94#-dic95-00-00-00-00-00-00-00-00-00",
                CreateDt    = DateTime.Now,
                UpdateDt    = DateTime.Now,
            };


            RequestModelString obj = new RequestModelString()
            {
                Info   = JsonStrObjConver.Obj2JsonStr(mod, typeof(GasCardWithCommInfo)),
                reqDt  = DateTime.Now,
                TockId = ConstDefineTestWebapi.TockIdEnableTest
            };

            string strParmaInfo = JsonStrObjConver.Obj2JsonStr(obj, typeof(RequestModelString));

            GlareLedServices2.GLSysMgrSoapClient cl = new GlareLedServices2.GLSysMgrSoapClient();

            string strResult = cl.AddCard(strParmaInfo);

            MessageBox.Show(strResult);
        }