Beispiel #1
0
 private void DoLoginWeb()
 {
     try
     {
         //获取系统参数
         decimal cid = DefaultConfig.DACONFIGID;
         //转换不成功
         if (!decimal.TryParse(ConfigurationManager.AppSettings["DaConfigID"], out cid))
         {
             ShowMessageHelper.ShowBoxMsg("请先维护好配置ID!");
             return;
         }
         config = configBll.SelectyDAConfigInfo(cid);
         if (config == null)
         {
             ShowMessageHelper.ShowBoxMsg("没有ID为[" + cid + "]的配置记录");
             return;
         }
         if (config != null)
         {
             LoginWebservice();
         }
         else
         {
             ShowMessageHelper.ShowBoxMsg("获取系统参数配置失败,请检查数据库表配置!");
             return;
         }
     }
     catch (Exception ex)
     {
         ShowMessageHelper.ShowBoxMsg("登录的过程中发生了错误,错误信息:" + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #2
0
        public static void saveDA(string valuesA, string valuesB, string valuesC, string valuesD)
        {
            DAConfig obj = new DAConfig();
            // Category - A
            var primeArrayA = valuesA.Split('*');
            int levelInc    = 2;

            for (int i = 0; i < primeArrayA.Length; i++)
            {
                obj.CityClass = "A";
                obj.UserLevel = "L" + levelInc;
                obj.Amount    = Convert.ToDouble(primeArrayA[i]);
                obj.SaveData(obj);
                levelInc++;
            }

            // Category - B
            levelInc = 2;
            var primeArrayB = valuesB.Split('*');

            for (int i = 0; i < primeArrayB.Length; i++)
            {
                obj.CityClass = "B";
                obj.UserLevel = "L" + levelInc;
                obj.Amount    = Convert.ToDouble(primeArrayB[i]);
                obj.SaveData(obj);
                levelInc++;
            }

            // Category - C
            levelInc = 2;
            var primeArrayC = valuesC.Split('*');

            for (int i = 0; i < primeArrayC.Length; i++)
            {
                obj.CityClass = "C";
                obj.UserLevel = "L" + levelInc;
                obj.Amount    = Convert.ToDouble(primeArrayC[i]);
                obj.SaveData(obj);
                levelInc++;
            }

            // Category - D
            levelInc = 2;
            var primeArrayD = valuesD.Split('*');

            for (int i = 0; i < primeArrayD.Length; i++)
            {
                obj.CityClass = "D";
                obj.UserLevel = "L" + levelInc;
                obj.Amount    = Convert.ToDouble(primeArrayD[i]);
                obj.SaveData(obj);
                levelInc++;
            }
        }
 /// <summary>
 /// WebService登录
 /// </summary>
 /// <returns></returns>
 public string[] UserLogin(DAConfig config)
 {
     //当系统配置为空时,返回错误信息
     if (config == null)
     {
         return("0|系统配置信息获取失败".Split('|'));
     }
     //登录
     string[] objLogin = new string[] { config.Sitecode, config.Username, config.Password, "医院LIS服务" };
     return(WebServiceUtils.ExecuteMethod("Login", objLogin).Split('|'));
 }
Beispiel #4
0
        //开始服务
        private void btnStart_Click(object sender, EventArgs e)
        {
            decimal cid = DefaultConfig.DACONFIGID;

            decimal.TryParse(ConfigurationManager.AppSettings["DaConfigID"], out cid);
            //读取默认配置
            config = new DAConfigBLL().SelectyDAConfigInfo(cid);
            if (config == null)
            {
                SetTB("没有维护配置文件!"); return;
            }

            //设置间隔时间
            timer.Interval = config.IntervalToDouble;

            double dInterval = 0;
            //获取配置时间间隔,设置logtimer间隔时间 fenghp
            string sss = ConfigurationManager.AppSettings["ErrorLogInterval"].ToString();

            double.TryParse(ConfigurationManager.AppSettings["ErrorLogInterval"].ToString(), out dInterval);

            logtimer.Interval  = dInterval * 1000 * 60;
            sendtimer.Interval = dInterval * 1000 * 60;

            //查询admin信息
            user.Usercode = "admin";
            user          = new DADictuserBLL().GetDADictuserInfoByUserCode(user);

            //开启
            timer.Start();
            logtimer.Start();
            SetTB("服务开启!");

            btnStart.Enabled = false;
            btnStop.Enabled  = true;
            btnStop.Focus();

            //更新webservice
            WebServiceUtils.SetIsUpdate(config.Address);

            DownResult();

            // UploadLog();

            //自动上传订单
            string issend = ConfigurationManager.AppSettings["IsSend"];

            if (issend == "1")
            {
                sendtimer.Start();
                sendOrders();
            }
        }
        /// <summary>
        /// 保存设置信息
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public bool SaveDAConfigInfo(DAConfig config)
        {
            bool b = true;

            //表中有记录
            if (SelectyDAConfigInfo(Convert.ToDecimal(config.DaConfigid)) == null)
            {
                InsertDAConfigInfo(config);
            }
            else
            {
                if (UpdateDAConfigInfo(config) == 0)
                {
                    b = false;
                }
            }
            return(b);
        }
Beispiel #6
0
        public static List <DAConfig> getDAAmount()
        {
            List <DAConfig> list = new List <DAConfig>();
            DAConfig        obj  = new DAConfig();

            obj.CityClass = "A";
            DataTable dt = new DataTable();

            dt = obj.getAmount();
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    obj = new DAConfig(Convert.ToDouble(dt.Rows[i]["Amount"].ToString()));
                    list.Add(obj);
                }
            }
            return(list);
        }
Beispiel #7
0
        /// <summary>
        /// 用戶登錄
        /// </summary>
        private void DoLogin()
        {
            try
            {
                string strCode = tbxUserName.Text.ToString();
                string strPwd  = desEncrypt.getMd5Hash(tbxPwd.Text.ToString());
                //获取用户信息
                DADictuser user = new DADictuser();
                user.Usercode = strCode;
                string strUsercode = user.Usercode;
                user = new DADictuserBLL().GetDADictuserInfoByUserCode(user);
                //获取系统参数
                decimal cid = DefaultConfig.DACONFIGID;
                //转换不成功
                if (!decimal.TryParse(ConfigurationManager.AppSettings["DaConfigID"], out cid))
                {
                    ShowMessageHelper.ShowBoxMsg("请先维护好配置ID!");
                    return;
                }
                config = configBll.SelectyDAConfigInfo(cid);
                if (config == null)
                {
                    ShowMessageHelper.ShowBoxMsg("没有ID为[" + cid + "]的配置记录");
                    return;
                }
                //再次校验用户名
                if (user == null || user.Usercode != strUsercode)
                {
                    ShowMessageHelper.ShowBoxMsg("帐号或密码错误,请重新输入!");
                    return;
                }
                //存在对应用户校验密码跟用户状态
                if (user != null && user.Password == strPwd)
                {
                    //账户已被停用
                    if (user.Isactive.ToString() == "0")
                    {
                        ShowMessageHelper.ShowBoxMsg("该账户已被停用!");
                        return;
                    }
                    else//账户未已被停用
                    {
                        //保存用户信息
                        LoginUserInfo userInfo = new LoginUserInfo();
                        userInfo.UserCode = tbxUserName.Text.ToString();
                        userInfo.UserId   = user.Dictuserid.ToString();
                        userInfo.UserName = user.Username;
                        userInfo.UserType = 1;
                        //登录webservice获取SID保存
                        if (config != null)
                        {
                            string strSideCode = config.Sitecode; //分点代码
                            string strUrl      = config.Address;  //调用webservice地址
                            string username    = config.Username; //登录用户名
                            string password    = config.Password; //登录用户密码

                            //设置调用webservice登录方法的参数
                            string[] par = new string[] { strSideCode, username, password, user.Username };
                            //获取webservice更新
                            WebServiceUtils.SetIsUpdate(config.Address);
                            //登录验证
                            object loginResult = WebServiceUtils.ExecuteMethod("Login", par);

                            //返回登录验证信息:1|SID,0|errorMsg
                            string[] loginMsg = loginResult.ToString().Split('|');
                            //登录成功 设置SID
                            if (loginMsg[0] == "1")
                            {
                                userInfo.SID = loginMsg[1].ToString();
                                ////设置调用webservice获取中心库数据(客户表、项目表、基础字典表)方法的参数
                                //DateTime itemdt = new DATablelastdateBLL().SelectyDATablelastdateInfoByTableName("da_dicttestitem");
                                //DateTime librarydt = new DATablelastdateBLL().SelectyDATablelastdateInfoByTableName("da_dictlibrary");
                                //DateTime customerdt = new DATablelastdateBLL().SelectyDATablelastdateInfoByTableName("da_dictcustomer");
                                //object[] parameters = new object[] { userInfo.SID, itemdt, librarydt, customerdt };
                                //string strXML = WebServiceUtils.Execute(strUrl, "GetCenterTableDate", parameters);
                                //string  reg  =   common.GetCenterTableDate(strXML);
                                //ShowMessageHelper.ShowBoxMsg(reg);
                            }
                            else
                            {
                                ShowMessageHelper.ShowBoxMsg("WebService登录失败,错误信息:" + loginMsg[1].ToString() + "\n请检查系统参数配置!");
                            }
                        }
                        //保存用户信息到SystemConfig类
                        SystemConfig.UserInfo = userInfo;
                        //登录成功
                        bLogin            = true;
                        this.DialogResult = DialogResult.OK;
                    }
                }
                else
                {
                    ShowMessageHelper.ShowBoxMsg("帐号或密码错误,请重新输入!");
                    return;
                }
            }
            catch (Exception ex)
            {
                ShowMessageHelper.ShowBoxMsg("登录的过程中发生了错误,错误信息:" + ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 /// <summary>
 /// 修改设置信息
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public int UpdateDAConfigInfo(DAConfig config)
 {
     return(service.update("UpdateDAConfig", config));
 }
 /// <summary>
 /// 添加设置信息
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public object InsertDAConfigInfo(DAConfig config)
 {
     return(service.insert("InsertDAConfig", config));
 }
        //保存
        private void btnSave_Click(object sender, EventArgs e)
        {
            /*验证界面输入
             *......
             */
            if (tbxHospName.Text.Trim() == string.Empty)
            {
                ShowMessageHelper.ShowBoxMsg("医院名称不能为空!");
                tbxHospName.Focus();
                return;
            }
            if (tbxWebAddress.Text.Trim() == string.Empty)
            {
                ShowMessageHelper.ShowBoxMsg("接口地址不能为空!");
                tbxWebAddress.Focus();
                return;
            }
            if (tbxUserName.Text.Trim() == string.Empty)
            {
                ShowMessageHelper.ShowBoxMsg("接口用户名不能为空!");
                tbxUserName.Focus();
                return;
            }
            if (tbxPassWrod.Text.Trim() == string.Empty)
            {
                ShowMessageHelper.ShowBoxMsg("接口密码不能为空!");
                tbxPassWrod.Focus();
                return;
            }
            if (tbxInterval.Text.Trim() == string.Empty)
            {
                ShowMessageHelper.ShowBoxMsg("接收时间间隔不能为空!并且间隔范围为[30-1440]!");
                tbxInterval.Focus();
                return;
            }
            if (tbxSiteCode.Text.Trim() == string.Empty)
            {
                ShowMessageHelper.ShowBoxMsg("分点代码不能为空!");
                tbxSiteCode.Focus();
                return;
            }

            if (Convert.ToDouble(tbxInterval.Text.Trim()) < 30 || Convert.ToDouble(tbxInterval.Text.Trim()) > 1440)
            {
                ShowMessageHelper.ShowBoxMsg("接收时间间隔范围为[30-1440]!");
                tbxInterval.Focus();
                return;
            }

            DAConfig config = new DAConfig();

            config.Hospname   = tbxHospName.Text;
            config.Address    = tbxWebAddress.Text;
            config.Username   = tbxUserName.Text;
            config.Password   = tbxPassWrod.Text;
            config.Interval   = tbxInterval.Text;
            config.Sitecode   = tbxSiteCode.Text;
            config.DaConfigid = lblID.Text == string.Empty ? cid : Convert.ToDecimal(lblID.Text);
            try
            {
                bool b = new DAConfigBLL().SaveDAConfigInfo(config);
                if (!b)
                {
                    ShowBox("保存失败,请重试!"); return;
                }
                ShowBox("保存成功!");
            }
            catch (Exception ex)
            {
                ShowBox("保存失败:" + ex.Message);
            }
        }