コード例 #1
0
ファイル: TypeParseTest.cs プロジェクト: shuntaro4/OreAka
        public void ToIntFalse1()
        {
            var actual = TypeParse.ToInt(null);

            Assert.Equal(0, actual);
        }
コード例 #2
0
ファイル: AnaResult.aspx.cs プロジェクト: bigbigwood/daan
        //将选中的结果录入值给编辑框
        protected void gvOrderTest_RowClick(object sender, GridRowClickEventArgs e)
        {
            if (gvOrderTest.SelectedRowIndexArray.Count <int>() != 0)
            {
                object[] objValue = gvOrderTest.DataKeys[gvOrderTest.SelectedRowIndexArray[0]];
                //是否检验项目,如果是结果值不能更改[ParamStatus.LabdeptType.FunctionDepartment为检验项目]
                List <Dictlabdept> labdept = loginservice.GetLoginDictlabdeptList();
                if (objValue[6].ToString() != "22" && labdept.Count(c => c.Labdepttype == ((int)ParamStatus.LabdeptType.InspectionDepartment).ToString() && c.Dictlabdeptid == TypeParse.StrToDouble(objValue[6], 0)) > 0)
                {
                    txtTestResult.Enabled  = false;
                    btnTestResult.Hidden   = true;
                    btnResultSelect.Hidden = true;
                    chkIsexception.Enabled = false;
                }
                else
                {
                    txtTestResult.Enabled  = true;
                    btnTestResult.Hidden   = false;
                    btnResultSelect.Hidden = false;
                    chkIsexception.Enabled = true;
                }
                txtTestResult.Text     = TypeParse.ObjToStr(objValue[3], "");
                chkIsexception.Checked = TypeParse.ObjToStr(objValue[7], "正常") == "正常" ? false : true;

                //结果录入模板初始化
                btnResultSelect.OnClientClick = WinResultEdit.GetSaveStateReference(txtTestResult.ClientID)
                                                + WinResultEdit.GetShowReference(string.Format("AnaResult_Windows.aspx?testId={0}", objValue[4]), "检查结果模板选择");
            }
            else
            {
                txtTestResult.Text = "";
            }
        }
コード例 #3
0
ファイル: AnaResult.aspx.cs プロジェクト: bigbigwood/daan
        //科室小结编辑
        protected void btnSaveOrderLabdeptResult_Click(object sender, EventArgs e)
        {
            //没有选取行
            if (gvOrderLabdeptResult.SelectedRowIndexArray.Count <int>() == 0)
            {
                MessageBoxShow("请选择要编辑的科室小结", MessageBoxIcon.Information);
                return;
            }
            object[] objValue = gvOrderLabdeptResult.DataKeys[gvOrderLabdeptResult.SelectedRowIndexArray[0]];

            List <Orderlabdeptresult> labdeptresultLst = OrderlabdeptresultData(objValue[1].ToString()).ToList <Orderlabdeptresult>();

            var labdeptresult = labdeptresultLst.Find(c => c.Ordertlabdeptresultid == TypeParse.StrToDouble(objValue[0], 0));

            labdeptresult.Labdeptresult = txtOrderLabdeptResult.Text;
            try
            {
                if (labdeptresultService.UpdateOrderlabdeptresult(labdeptresult))
                {
                    //绑定科室小结列表
                    gvOrderLabdeptResult.DataSource = OrderlabdeptresultData(objValue[1].ToString());
                    gvOrderLabdeptResult.DataBind();
                    txtOrderLabdeptResult.Text = "";
                }
            }
            catch (Exception ex)
            {
                MessageBoxShow("科室小结保存出错,错误描述:" + ex.Message, MessageBoxIcon.Error);
            }
        }
コード例 #4
0
 public static Message GetMessage(List <DbParameter> prams)
 {
     return(new Message(TypeParse.StrToInt(prams[prams.Count - 1].Value, -1), prams[prams.Count - 2].Value.ToString()));
 }
コード例 #5
0
ファイル: HtmlHelperExtensions.cs プロジェクト: zz110/WKT2015
 /// <summary>
 /// 站点ID
 /// </summary>
 /// <param name="helper"></param>
 /// <returns></returns>
 public static long JournalID(this HtmlHelper helper)
 {
     return(TypeParse.ToLong(ConfigurationManager.AppSettings["SiteID"]));
 }
コード例 #6
0
        /// <summary>
        /// 获取值
        /// </summary>
        /// <param name="arguments"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public static int GetIntValue <T>(this IEnumerable <T> arguments, string key) where T : KeyValueEntity
        {
            var item = arguments.FirstOrDefault(x => String.Equals(key, x.Key, StringComparison.OrdinalIgnoreCase));

            return(item == null ? 0 : TypeParse.StrToInt(item.Value));
        }
コード例 #7
0
ファイル: BasePage.cs プロジェクト: richarduan/elink56
 /// <summary>
 /// style
 /// </summary>
 /// <param name="cssName"></param>
 /// <returns></returns>
 public string staticSstyle(string cssName)
 {
     return("<link href=\"http://" + this.caterDomain + "" + cssName + "?rnd=" + TypeParse.RandomNum().ToString() + "\" rel=\"stylesheet\" />");
 }
コード例 #8
0
 public static float StrToFloat(object strValue, float defValue)
 {
     return(TypeParse.StrToFloat(strValue, defValue));
 }
コード例 #9
0
 public static int StrToInt(object Expression, int defValue)
 {
     return(TypeParse.StrToInt(Expression, defValue));
 }
コード例 #10
0
ファイル: OrderList.aspx.cs プロジェクト: lamjar/shop
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string uid = "";
                if (Request.Cookies["tfuid"] != null)
                {
                    uid = TypeParse.DbObjToString(Request.Cookies["tfuid"].Value, "");
                }
                else
                {
                    Response.Redirect("/UserLog");
                }
                int page = 1;
                if (Request.QueryString["page"] != null)
                {
                    page = TypeParse.DbObjToInt(Request.QueryString["page"].ToString(), 1);
                }
                pageinfo pdata = new pageinfo();
                pdata.curpageindex = page;
                pdata.pagesize     = 10;
                if (RouteData.Values["orderstate"] != null)
                {
                    pdata.where       = "a.deliveryIid=c.deliveryIid and a.deliveryIIid=d.deliveryIIid  and a.orderstate=" + RouteData.Values["orderstate"].ToString() + " and a.userid='" + uid + "'";
                    pdata.recordcount = order.getcountbycondition("userorder.orderstate=" + RouteData.Values["orderstate"].ToString() + "  and userorder.userid='" + uid + "'");
                    if (RouteData.Values["orderstate"].ToString() == "0")
                    {
                        orderh3HTML = "我的进行中的订单";
                    }
                    else if (RouteData.Values["orderstate"].ToString() == "10")
                    {
                        orderh3HTML = "我的已完成的订单";
                    }
                    else if (RouteData.Values["orderstate"].ToString() == "44")
                    {
                        orderh3HTML = "我的待处理的订单";
                    }
                    else
                    {
                        orderh3HTML = "我的订单";
                    }
                }
                else
                {
                    pdata.where       = "a.deliveryIid=c.deliveryIid and a.deliveryIIid=d.deliveryIIid and  a.userid='" + uid + "'";
                    pdata.recordcount = order.getcountbycondition("userorder.userid='" + uid + "'");
                    orderh3HTML       = "我的订单";
                }
                pdata.tablename      = "userorder a,deliveryI c,deliveryII d";
                pdata.fieldlist      = "a.orderid,a.orderstate,a.ordernumber,a.orderdate,a.deliverydate,a.allmoney,a.paymoney,a.contact,a.tel,a.mobile,a.address,c.deliveryI,d.deliveryII";
                pdata.sorttype       = 2;
                pdata.primarykey     = "orderid";
                pdata.totalpagecount = (pdata.recordcount % pdata.pagesize == 0 ? pdata.recordcount / pdata.pagesize : pdata.recordcount / pdata.pagesize + 1);
                if (pdata.totalpagecount == 0)
                {
                    pdata.totalpagecount = 1;
                }

                List <orderinfo> list = order.getorderlist(pdata);
                StringBuilder    sb   = new StringBuilder();
                foreach (orderinfo item in list)
                {
                    string template = " <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"otb\"><tr style=\"height: 30px; line-height: 30px; background-color:#fff\"><td colspan=\"6\" style=\"padding-left: 10px;\"><span class=\"fb\">订单编号:{0}</span>&nbsp;&nbsp;下单日期:{1}&nbsp;&nbsp;送货日期:{2}</td></tr><tr style=\"height: 30px; line-height: 30px; background-color:#fff\"><td colspan=\"6\" style=\"padding-left: 10px;\">收货人:{3}&nbsp;&nbsp;手机号码:{4}&nbsp;&nbsp;固定电话:{5}</td></tr><tr style=\"height: 30px; line-height: 30px; background-color:#fff\"><td colspan=\"3\" style=\"padding-left: 10px;\">地址:{6}</td><td colspan=\"2\" align=\"center\">产品总额:¥{7}元</td><td align=\"center\">应付总额:<span class=\"fb red\">¥{8}元</span></td></tr><tr style=\"height: 30px; line-height: 30px; background-color:#efefef\"><td style=\"padding-left: 10px;\">序号</td><td align=\"center\">产品图片</td><td align=\"center\">产品名称</td><td align=\"center\">购买数量</td><td align=\"center\">产品单价 </td><td align=\"center\">小计</td></tr> ";
                    sb.AppendFormat(template, item.ordernumber, item.orderdate, item.deliverydate, item.contact, item.tel, item.mobile, item.address, item.allmoney.ToString("f2"), item.paymoney.ToString("f2"));
                    List <orderinfo> plist = order.getcartlistbyordernumber(item.ordernumber);
                    for (int k = 0; k < plist.Count; k++)
                    {
                        string ptemplate = "<tr style=\"height: 30px; line-height: 30px; background-color:#fff\"><td style=\"padding-left: 10px;\">{0}</td><td align=\"center\" class=\"oimg\"><a href=\"/PInfo/{1}\" target=\"_blank\"><img src=\"/Files/Product/{2}\" /></a></td><td align=\"center\">{3}</td><td align=\"center\">{4}</td><td align=\"center\">{5}</td><td align=\"center\">{6}</td></tr>";
                        sb.AppendFormat(ptemplate, k + 1, plist[k].productid, plist[k].productimg, plist[k].productname, plist[k].buynum, plist[k].vipprice.ToString("f2"), (plist[k].vipprice * plist[k].buynum).ToString("f2"));
                    }
                }
                sb.Append("</table>");
                orderlistHTML = sb.ToString();
                pageHTML      = pagehelper.Pager(pdata.curpageindex, pdata.pagesize, pdata.recordcount, PageMode.Numeric, 5);
            }
        }
コード例 #11
0
 public static bool StrToBool(object Expression, bool defValue)
 {
     return(TypeParse.StrToBool(Expression, defValue));
 }
コード例 #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="topicName"></param>
        private void CreateAppTopicConsumer(IConnection connection, TopicName topicName)
        {
            //通过连接创建一个会话
            ISession session = connection.CreateSession();
            //通过会话创建一个消费者,这里就是Queue这种会话类型的监听参数设置
            string           whereClause = string.Format("{0}='{1}'", MqConsts.ClientId, TypeParse.StrToGuid(_appId).ToString().ToLower());
            IMessageConsumer consumer    = session.CreateConsumer(new ActiveMQTopic(GetAppTopicName(topicName)), whereClause);

            //注册监听事件
            consumer.Listener += message => { ConsumerOnListener(topicName, message); };
            _logger.Debug(string.Format("Listener主题消费者创建:{0} IP:{1}:{2}  where:{3}", topicName, _configInfo.IpAddress, _configInfo.Port, whereClause));
        }
コード例 #13
0
        public string BankBind(int cid = 0, int UserId = 0, string mobile = "", string bankcard = "", string bankcode = "", int typeid = 0, string cvn2 = "", string expiresYear = "", string expiresMouth = "", string OpeningBank = "", string OpeningSerialBank = "", int BankID = 0)
        {
            Logs.WriteLog($"Action:User,Cmd:BankBind,UserId:{UserId},mobile:{mobile},bankcard:{bankcard},bankcode:{bankcode},typeid:{typeid},cvn2:{cvn2},expiresYear:{expiresYear},expiresMouth:{expiresMouth},OpeningBank:{OpeningBank},OpeningSerialBank:{OpeningSerialBank}", "d:\\Log\\ITOrm", "BankBind");
            userEventDao.UserBankBind(cid, UserId, Ip.GetClientIp(), mobile, bankcard, bankcode, typeid, cvn2, expiresYear, expiresMouth, OpeningBank, OpeningSerialBank, BankID);

            var version = TQuery.GetString("version");

            if (cid == 3 && version == "1.0.0")
            {
                string temp = expiresYear;
                expiresYear  = expiresMouth;
                expiresMouth = temp;
            }
            #region 验证
            if (!TypeParse.IsMobile(mobile))
            {
                return(ApiReturnStr.getError(-100, "预留手机号格式验证失败"));
            }
            if (!(bankcard.Length > 13 && bankcard.Length < 21))
            {
                return(ApiReturnStr.getError(-100, "银行卡参数错误"));
            }
            if (string.IsNullOrEmpty(bankcode))
            {
                return(ApiReturnStr.getError(-100, "银行编号不能为空"));
            }
            Users user = userDao.Single(UserId);
            if (user == null || user.UserId <= 0)
            {
                return(ApiReturnStr.getError(-100, "用户不存在"));
            }
            if (user.IsRealState != 1)
            {
                return(ApiReturnStr.getError(-100, "用户未实名认证,无法绑卡"));
            }
            if (typeid == 1)//如果是结算卡
            {
                if (string.IsNullOrEmpty(cvn2) || string.IsNullOrEmpty(expiresYear) || string.IsNullOrEmpty(expiresMouth))
                {
                    return(ApiReturnStr.getError(-100, "支付卡参数有误"));
                }

                if (BankID == 0)
                {
                    UserBankCard ubc = userBankCardDao.Single(" UserId=@UserId and BankCard=@bankcard and TypeId=1  ", new { UserId, bankcard });
                    if (ubc != null && ubc.ID > 0)
                    {
                        return(ApiReturnStr.getError(-100, "该支付卡已经绑定过,不能重复绑定"));
                    }
                }
            }
            else
            {
                UserBankCard ubc = userBankCardDao.Single(" UserId=@UserId and TypeId=0 and  State=1 ", new { UserId });
                if (ubc != null && ubc.ID > 0)
                {
                    return(ApiReturnStr.getApiData(-100, "结算卡只能绑定一张"));
                }
            }
            UserBankCard model = null;
            if (BankID > 0)
            {
                model = userBankCardDao.Single(BankID);
                if (model == null)
                {
                    return(ApiReturnStr.getApiData(-100, "BankID记录不存在"));
                }
                if (model.State == 1)
                {
                    return(ApiReturnStr.getApiData(-100, "该银行卡已通过验证,不可修改信息"));
                }
            }
            else
            {
                model = new UserBankCard();
            }
            #endregion

            #region 绑卡
            var result = BankCardBindHelper.Bind(typeid, user.RealName, user.IdCard, bankcard, mobile, cvn2, expiresYear, expiresMouth);

            model.BankCard          = result.bankCard;
            model.BankCode          = bankcode;
            model.BankName          = bankDao.QueryBankName(bankcode);
            model.CVN2              = cvn2;
            model.ExpiresYear       = expiresYear;
            model.ExpiresMouth      = expiresMouth;
            model.UTime             = DateTime.Now;
            model.Mobile            = mobile;
            model.TypeId            = typeid;
            model.OpeningBank       = OpeningBank;
            model.OpeningSerialBank = OpeningSerialBank;
            model.State             = 0;// result.backState ? 1 : 0;//默认为0
            model.RelationId        = ",0,";
            bool flag = false;
            if (BankID == 0)
            {
                model.UserId   = UserId;
                model.IP       = Ip.GetClientIp();
                model.CTime    = DateTime.Now;
                model.Platform = cid;
                int num = userBankCardDao.Insert(model);
                flag = num > 0;
                return(ApiReturnStr.getError(flag ? 0 : -100, flag ? "绑定成功" : "绑定失败"));
            }
            else
            {
                var list = bankTreatyApplyDao.GetQuery(" State=2 And UbkID=@BankID", new { BankID });
                if (list != null && list.Count > 0)
                {
                    foreach (var item in list)
                    {
                        MasgetDepository.TreatyModify(BankID, cvn2, expiresYear, expiresMouth, cid, (Logic.ChannelType)item.ChannelType);
                    }
                }
                flag = userBankCardDao.Update(model);
                return(ApiReturnStr.getError(flag ? 0 : -100, flag ? "修改成功" : "修改失败"));
            }

            #endregion
        }
コード例 #14
0
        /// <summary>
        /// 用户注册
        /// </summary>
        /// <param name="cid"></param>
        /// <param name="mobile">手机号</param>
        /// <param name="password">密码</param>
        /// <param name="mcode">手机验证码</param>
        /// <param name="regGuid">令牌</param>
        /// <param name="baseUserId">推荐人</param>
        /// <returns></returns>
        public string Register(int cid = 0, string mobile = "", string password = "", string mcode = "", string regGuid = "", int baseUserId = 0, string ip = "")
        {
            Logs.WriteLog($"Register,cid:{cid},mobile:{mobile},password:{password},mcode:{mcode},regGuid:{regGuid},baseUserId:{baseUserId}", "d:\\Log\\ITOrm", "Register");
            #region 验证
            if (!TypeParse.IsMobile(mobile))
            {
                return(ApiReturnStr.getError(-100, "手机号格式验证失败"));
            }
            if (password.Length != 32)
            {
                return(ApiReturnStr.getError(-100, "密码格式错误"));
            }
            if (mcode.Length != 6)
            {
                return(ApiReturnStr.getError(-100, "手机验证码格式错误"));
            }
            if (regGuid.Length != 36)
            {
                return(ApiReturnStr.getError(-100, "短信令牌格式错误"));
            }

            string key = ITOrm.Utility.Const.Constant.reg_mobile_code + regGuid;
            if (!ITOrm.Utility.Cache.MemcachHelper.Exists(key))
            {
                return(ApiReturnStr.getError(-100, "短信验证码已过期"));
            }

            JObject mobileCodeData = JObject.Parse(ITOrm.Utility.Cache.MemcachHelper.Get(key).ToString());
            if (mobileCodeData["code"].ToString() != mcode)
            {
                return(ApiReturnStr.getError(-100, "短信验证码错误"));
            }
            if (mobileCodeData["mobile"].ToString() != mobile)
            {
                return(ApiReturnStr.getError(-100, "手机号码不是接收短信的手机号码"));
            }

            if (baseUserId > 0)
            {
                var baseUser = userDao.Single(baseUserId);
                if (baseUser == null || baseUser.UserId == 0)
                {
                    return(ApiReturnStr.getError(-100, "该邀请人不存在"));
                }
            }
            var modelUsers = userDao.Single(" mobile=@mobile ", new { mobile });
            if (modelUsers != null && modelUsers.UserId > 0)
            {
                return(ApiReturnStr.getError(-100, "该手机号已注册"));
            }
            #endregion
            ip = string.IsNullOrEmpty(ip) ? ITOrm.Utility.Client.Ip.GetClientIp() : ip;
            var model = new Users();
            model.BaseUserId  = baseUserId;
            model.CTime       = DateTime.Now;
            model.Email       = "";
            model.IdCard      = "";
            model.IP          = ip;
            model.IsRealState = 0;
            model.Mobile      = mobile;
            model.Password    = password;
            model.PlatForm    = cid;
            model.RealName    = "";
            model.Soure       = "";
            model.State       = 0;
            model.UserName    = mobile;
            model.UTime       = DateTime.Now;
            model.RealTime    = DateTime.Now;
            model.VipType     = (int)Logic.VipType.SVIP;
            var result  = userDao.Insert(model);
            var account = new Account();
            account.UserId    = result;
            account.CTime     = DateTime.Now;
            account.UTime     = DateTime.Now;
            account.Frozen    = 0m;
            account.Available = 0m;
            account.Total     = 0m;
            var resultAccount = accountDao.Insert(account);
            if (result > 0 && resultAccount > 0)
            {
                JObject obj = new JObject();
                obj["UserId"] = result;
                userEventDao.UserRegister(cid, ip, result, 1, mobile, password, mcode, regGuid, baseUserId, TQuery.GetString("version"));
                ITOrm.Utility.Cache.MemcachHelper.Delete(key);//销毁本次验证码缓存
                return(ApiReturnStr.getApiData(0, "注册成功", obj));
            }
            else
            {
                return(ApiReturnStr.getError(-100, "注册失败"));
            }
        }
コード例 #15
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="TElement"></typeparam>
        /// <param name="row"></param>
        /// <param name="columns"></param>
        /// <returns></returns>
        public virtual TElement Format <TElement>(DataRow row, DataColumnCollection columns = null) where TElement : class, new()
        {
            if (row == null)
            {
                return(null);
            }
            if (columns == null)
            {
                columns = row.Table.Columns;
            }
            TElement            element      = new TElement();
            List <PropertyInfo> propertyList = GetPropertyInfos(typeof(TElement));

            foreach (DataColumn column in columns)
            {
                var    columnName = column.ColumnName;
                object value      = null;
                var    property   = propertyList.FirstOrDefault(x => string.Equals(x.Name, column.ColumnName, StringComparison.OrdinalIgnoreCase));
                if (property == null)
                {
                    continue;
                }
                try
                {
                    if (property.PropertyType == typeof(int) || property.PropertyType == typeof(int?))
                    {
                        value = TypeParse.StrToInt(row[columnName]);
                    }
                    else if (property.PropertyType == typeof(decimal) || property.PropertyType == typeof(decimal?))
                    {
                        value = TypeParse.StrToDecimal(row[columnName], 0);
                    }
                    else if (property.PropertyType == typeof(double) || property.PropertyType == typeof(double?))
                    {
                        value = TypeParse.StrToDecimal(row[columnName], 0);
                    }
                    else if (property.PropertyType == typeof(float) || property.PropertyType == typeof(float?))
                    {
                        value = TypeParse.StrToDecimal(row[columnName], 0);
                    }
                    else if (property.PropertyType == typeof(Int64) || property.PropertyType == typeof(Int64?))
                    {
                        value = TypeParse.StrToInt64(row[columnName], 0);
                    }
                    else if (property.PropertyType == typeof(short) || property.PropertyType == typeof(short?))
                    {
                        value = TypeParse.StrToInt(row[columnName], 0);
                    }
                    else if (property.PropertyType == typeof(DateTime))
                    {
                        value = TypeParse.StrToDateTime(row[columnName]);
                    }
                    else if (property.PropertyType == typeof(DateTime?))
                    {
                        value = TypeParse.ConvertToNullableDateTime(row[columnName]);
                    }
                    else if (property.PropertyType == typeof(string))
                    {
                        value = Convert.ToString(row[columnName]);
                    }
                    else if (property.PropertyType == typeof(Guid) || property.PropertyType == typeof(Guid?))
                    {
                        value = TypeParse.StrToGuid(row[columnName]);
                    }
                    else if (property.PropertyType == typeof(bool) || property.PropertyType == typeof(bool?))
                    {
                        value = TypeParse.StrToBool(row[columnName]);
                    }
                    else if (property.PropertyType == typeof(byte) || property.PropertyType == typeof(byte?))
                    {
                        value = (byte)TypeParse.StrToInt(row[columnName]);
                    }
                    else
                    {
                        // Logger.Trace(string.Format("Fromat 错误:{0} 列值类型无效 {1}", property.Name, property.PropertyType));
                        continue;
                    }
                    property.SetValue(element, value, new object[] { });
                }
                catch (Exception ex)
                {
                    Logger.Error(ex, "Fromat");
                }
            }
            return(element);
        }
コード例 #16
0
 public static bool IsDouble(object Expression)
 {
     return(TypeParse.IsDouble(Expression));
 }
コード例 #17
0
        /// <summary>
        /// 接收数据
        /// </summary>
        /// <param name="SID"></param>
        /// <param name="XML"></param>
        /// <returns></returns>
        public static string ReceiveXMLData(string SID, string xmlStr)
        {
            xmlStr = xmlStr.TrimStart('');
//            if (xmlStr == string.Empty)
//            {
//                xmlStr = @"
//                        &lt;data&gt;&lt;datarow&gt;
//                        &lt;uniquecode &gt;TY0008&lt;/uniquecode &gt;
//                        &lt;dictcustomerid&gt;1396&lt;/dictcustomerid&gt;
//                        &lt;barcode&gt;380003772900&lt;/barcode&gt;
//                        &lt;realname&gt;马昌武3&lt;/realname&gt;
//                        &lt;sex&gt;男&lt;/sex&gt;
//                        &lt;birthday&gt;&lt;/birthday&gt;
//                        &lt;age&gt;41&lt;/age&gt;
//                        &lt;ismarried&gt;未知&lt;/ismarried&gt;
//                        &lt;mobile&gt;13096786113&lt;/mobile&gt;
//                        &lt;idnumber&gt;&lt;/idnumber&gt;
//                        &lt;address&gt;地址&lt;/address&gt;
//                        &lt;section&gt;遵义&lt;/section&gt;
//                        &lt;remark&gt;备注&lt;/remark&gt;
//                        &lt;phone&gt;&lt;/phone&gt;
//                        &lt;email&gt;&lt;/email&gt;
//                        &lt;samplingdate&gt;2014-12-18&lt;/samplingdate&gt;
//                        &lt;province&gt;广东&lt;/province&gt;
//                        &lt;city&gt;广州市&lt;/city&gt;
//                        &lt;county&gt;天河区&lt;/county&gt;
//                        &lt;dictlabid&gt;3&lt;/dictlabid&gt;
//                        &lt;/datarow&gt;&lt;/data&gt;
//                        ";
//            }
            string str        = "<?xml version='1.0' encoding='utf-8'?>" + StringToXML(xmlStr);
            string strMessage = string.Empty;
            //缓存取登录用户
            Cache     cache = new Cache();
            CacheInfo info  = cache.GetCacheData(SID);
            DataTable dt    = new DataTable();

            try
            {
                dt = GetDataTable(str);
            }
            catch (Exception ex)
            {
                return(String.Format("{0} {1}", ErrorCode.Rec_1002, ex.Message));
            }
            if (dt == null || dt.Rows.Count == 0 || dt.Columns.Count != 20)
            {
                return(ErrorCode.Rec_1003);
            }

            List <Dicttestitem>      TestItemList  = loginservice.GetLoginDicttestitemList();  //项目字典表
            List <Dictproductdetail> ProductDetail = loginservice.GetLoginDictproductdetail(); //套餐组合字典
            string _productname = string.Empty;

            foreach (DataRow dr in dt.Rows)
            {
                #region 必填项
                //套餐代码
                string productTestCode = dr["uniquecode"].ToString().Replace('_', ' ').Trim();
                //客户代码
                string dictcustomercode = dr["dictcustomerid"].ToString().Trim();
                //条码号
                string barcode = dr["barcode"].ToString().Trim();
                //姓名
                string realname = dr["realname"].ToString().Trim();
                //性别
                string sex = dr["sex"].ToString().Replace('_', ' ').Trim() == "女" ? "F" : (dr["sex"].ToString().Replace('_', ' ').Trim() == "男" ? "M" : "U");
                //婚否
                string ismarried = dr["ismarried"].ToString().Trim();
                //手机
                string mobile = dr["mobile"].ToString().Trim();
                //住址
                string address = dr["address"].ToString().Trim();
                //省
                string province = dr["province"].ToString().Trim();
                //市
                string city = dr["city"].ToString().Trim();
                //分点实验室
                string dictlabid = dr["dictlabid"].ToString().Trim();

                if (string.IsNullOrEmpty(productTestCode) || string.IsNullOrEmpty(dictcustomercode) || string.IsNullOrEmpty(dictlabid) ||
                    string.IsNullOrEmpty(realname) || string.IsNullOrEmpty(sex) || string.IsNullOrEmpty(ismarried) ||
                    string.IsNullOrEmpty(mobile) || string.IsNullOrEmpty(address) || string.IsNullOrEmpty(province) || string.IsNullOrEmpty(city))
                {
                    strMessage = ErrorCode.Rec_1005;
                    break;
                }
                #endregion

                #region 二者不可都为空
                //出生日期
                string birthday = dr["birthday"].ToString().Trim();
                //年龄
                string age = dr["age"].ToString().Trim();
                if (string.IsNullOrEmpty(birthday) && string.IsNullOrEmpty(age))
                {
                    strMessage = ErrorCode.Rec_1006;
                    break;
                }
                #endregion

                #region 可空字段
                //身份证
                string idnumber = dr["idnumber"].ToString().Trim();
                //部门
                string section = dr["section"].ToString().Trim();
                //备注
                string remark = dr["remark"].ToString().Trim();
                //电话
                string phone = dr["phone"].ToString().Trim();
                //邮箱
                string email = dr["email"].ToString().Trim();
                //采样日期
                string samplingdate = dr["samplingdate"].ToString().Trim();
                //区
                string county = dr["county"].ToString().Trim();
                #endregion

                DateTime datebirthday;
                bool     datebirthdayb = DateTime.TryParse(birthday, out datebirthday);
                DateTime datesamplingdate;
                bool     datesamplingdateb = DateTime.TryParse(samplingdate, out datesamplingdate);
                if ((birthday != string.Empty && !datebirthdayb) || (samplingdate != string.Empty && !datesamplingdateb))
                {
                    strMessage = ErrorCode.Rec_1013;
                    break;
                }
                //检查单位是否在体检系统中有维护
                string dictcustomerid = string.Empty;
                try
                {
                    using (DataTable d = customerservice.CheckHasCustomer(dictcustomercode))
                    {
                        if (d == null || d.Rows.Count == 0 || d.Rows.Count > 1)
                        {
                            strMessage = ErrorCode.Up_0011;
                            break;
                        }
                        else
                        {
                            dictcustomerid = d.Rows[0][0].ToString();
                        }
                    }
                }
                catch (Exception ee)
                {
                    strMessage = ErrorCode.Up_0015 + " " + ee.Message;
                    break;
                }

                #region 添加套餐
                //查询分点+公用套餐
                List <Dicttestitem> productlistTemp = new DicttestitemService().GetProduct(TypeParse.StrToDouble(dictcustomerid, 0));
                List <Dicttestitem> productList     = productlistTemp.Where <Dicttestitem>(c => c.Testcode == productTestCode && (c.Forsex == sex || c.Forsex == "B")).ToList <Dicttestitem>();
                List <Dicttestitem> grouptestList   = new List <Dicttestitem>();
                Dicttestitem        productinfo     = null;
                if (productList.Count == 0)
                {
                    strMessage = ErrorCode.Rec_1008;
                    break;
                }
                else if (productList.Count > 1)
                {
                    strMessage = ErrorCode.Rec_1009;
                    break;
                }
                else
                {
                    productinfo = productList.First <Dicttestitem>();
                    List <OrderRegister> _gridtestList = null;
                    #region 添加套餐
                    string msg = registerservice.AddProduct(ref _gridtestList, sex, productinfo.Dicttestitemid, false, null, ref _productname, null);
                    if (msg != string.Empty)
                    {
                        strMessage = ErrorCode.Rec_1017;
                        break;
                    }
                    #endregion
                    if (barcode != string.Empty && barcode.Length != 12)//条码号必须为12位数字
                    {
                        strMessage = ErrorCode.Rec_1010;
                        break;
                    }
                    if (barcode != string.Empty && barcode.Substring(barcode.Length - 2) != "00")//条码号必须以00结尾
                    {
                        strMessage = ErrorCode.Rec_1011;
                        break;
                    }
                    if (barcodeservice.CheckBarCode(barcode))//条码号已在系统中存在
                    {
                        strMessage = ErrorCode.Rec_1012;
                        break;
                    }

                    //套餐下组合项目
                    IEnumerable <Dictproductdetail> IEgroup = ProductDetail.Where <Dictproductdetail>(c => c.Productid == productinfo.Dicttestitemid);
                    bool iscontinue = true;
                    int  count      = IEgroup.Count <Dictproductdetail>();
                    int  k          = 0;
                    foreach (Dictproductdetail item in IEgroup)
                    {
                        IEnumerable <Dicttestitem> IEgruptest = TestItemList.Where <Dicttestitem>(c => c.Dicttestitemid == item.Testgroupid);
                        if (IEgruptest.Count() <= 0)
                        {
                            //没有找到套餐下组合
                            k++;
                            continue;
                        }
                        Dicttestitem groupinfo = IEgruptest.First <Dicttestitem>();
                        //校验性别是否符合
                        string res = registerservice.checkSex(groupinfo.Dicttestitemid, sex);
                        if (res != string.Empty)
                        {
                            //性别项目不合
                            strMessage = ErrorCode.Rec_1015;
                            iscontinue = false;
                            break;
                        }

                        groupinfo.Productid   = productinfo.Dicttestitemid;
                        groupinfo.Productname = productinfo.Testname; ///套餐名
                        groupinfo.IsActive    = "1";                  //是否停止测试
                        groupinfo.Isadd       = "0";                  ///是否追加
                        groupinfo.Billed      = "0";
                        groupinfo.Sendbilled  = "0";
                        groupinfo.Adduserid   = null;//追加人ID

                        if (barcode == string.Empty)
                        {
                            IEnumerable <Dicttestitem> IEtempbarcodeList = grouptestList.Where <Dicttestitem>(c => c.Tubegroup == groupinfo.Tubegroup);
                            if (IEtempbarcodeList.Count() > 0)
                            {
                                groupinfo.Barcode = IEtempbarcodeList.First <Dicttestitem>().Barcode;
                            }
                            else
                            {
                                groupinfo.Barcode = registerservice.GetBarCode();
                            }
                        }
                        else
                        {
                            groupinfo.Barcode = barcode;
                        }

                        //获取外包客户
                        Dictproductdetail detail = ProductDetail.Where <Dictproductdetail>(c => c.Productid == productinfo.Dicttestitemid && c.Testgroupid == groupinfo.Dicttestitemid).First <Dictproductdetail>();
                        groupinfo.Sendoutcustomerid = detail.Sendoutcustomerid;

                        grouptestList.Add(groupinfo);
                    }
                    if (!iscontinue)
                    {
                        continue;
                    }
                    else
                    {
                        if (k >= count)
                        {
                            strMessage = ErrorCode.Rec_1016;
                            break;
                        }
                    }
                }
                #endregion

                #region 添加会员
                Dictmember member = new Dictmember()
                {
                    Realname = realname, Idnumber = idnumber, Nickname = realname, Sex = sex, Addres = address,
                    Phone    = phone, Mobile = mobile, Email = email
                };
                if (datebirthdayb)
                {
                    member.Birthday = datebirthday;
                }
                registerservice.checkmember(null, ref member);
                #endregion

                #region 添加订单
                double year = 0, month = 0, day = 0;
                double hours  = 0;
                double aged   = 0;
                string agestr = age;
                bool   ageb   = double.TryParse(agestr, out aged);

                if (member.Birthday == null)
                {
                    if (agestr != string.Empty && ageb)
                    {
                        year            = aged;
                        day             = aged * 365;
                        member.Birthday = datebirthday = DateTime.Now.AddDays((0 - day));
                    }
                    else
                    {
                        strMessage = ErrorCode.Rec_1006;
                        break;
                    }
                }
                TimeSpan ts = DateTime.Now - Convert.ToDateTime(member.Birthday);//时间差
                year  = Math.Truncate((double)(ts.Days / 365));
                month = (ts.Days % 365) / 30;
                day   = (ts.Days % 365) % 30;
                hours = ts.TotalHours;

                Orders _orders = new Orders()
                {
                    Ordernum     = new ProRegisterService().GetOrderNum(),
                    Dictmemberid = member.Dictmemberid, Dictcustomerid = Convert.ToDouble(dictcustomerid),
                    Realname     = realname, Sex = sex, Caculatedage = hours, Remarks = remark,
                    Age          = string.Format("{0}岁{1}月{2}日{3}时", year, month, day, 0), Enterby = "admin",
                    Ordertestlst = _productname + ",", Dictlabid = Convert.ToDouble(dictlabid), Ordersource = "1",
                    Ismarried    = ismarried == "未婚" ? "0" : (ismarried == "已婚" ? "1" : "2"), Section = section,
                    Status       = ((int)daan.service.common.ParamStatus.OrdersStatus.BarCodePrint).ToString(),
                    Province     = province, City = city, County = county
                };
                if (datesamplingdateb)
                {
                    _orders.SamplingDate = datesamplingdate;
                }
                string errstr = string.Empty;
                bool   b      = registerservice.insertUpdateOrders("易感基因对接订单", "", true, productList, grouptestList, member, _orders, "", ref errstr);
                if (!b)
                {
                    strMessage = String.Format("{0} {1}", ErrorCode.Rec_1018, errstr);
                }
                #endregion
            }
            return(strMessage);
        }
コード例 #18
0
 public static bool IsNumeric(object Expression)
 {
     return(TypeParse.IsNumeric(Expression));
 }
コード例 #19
0
        /// <summary>
        /// 获取用户标识
        /// </summary>
        /// <param name="strUserID"></param>
        /// <returns></returns>
        public static int GetUserID(string strUserID)
        {
            int dwUserID = TypeParse.StrToInt(CWHEncryptNet.XorCrevasse(strUserID), 0);

            return(dwUserID);
        }
コード例 #20
0
 public static bool IsNumericArray(string[] strNumber)
 {
     return(TypeParse.IsNumericArray(strNumber));
 }
コード例 #21
0
ファイル: EditUser.aspx.cs プロジェクト: chcyellow/SEPkuang
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (lstSelectedRole.Items.Count > 0)
        {
            foreach (ListItem item in lstSelectedRole.Items)
            {
                txtTRole.Text += item.Value + ",";
            }
            User          bll = new User();
            List <string> ar  = new List <string>(); //添加表
            List <string> dr  = new List <string>(); //删除表
            string        s   = txtTRole.Text;
            if (s != "")
            {
                string[] str  = s.Substring(0, s.Length - 1).Split(',');
                string[] ostr = txtOldRole.Text.ToString().Split(',');
                for (int i = 0; i < str.Length; i++)
                {
                    if (!TypeParse.IsStringArray(str[i], ostr))
                    {
                        //不存在则添加到插入记录列表
                        ar.Add(uid.Text + "," + str[i]);
                    }
                }

                for (int i = 0; i < ostr.Length; i++)
                {
                    if (!TypeParse.IsStringArray(ostr[i], str))
                    {
                        //不存在则添加到删除记录列表
                        dr.Add(uid.Text + "," + ostr[i]);
                    }
                }
            }
            else
            {
                //如果提交角色为空则删除该用户的所有角色
                string[] ostr = txtOldRole.Text.ToString().Split(',');
                for (int i = 0; i < ostr.Length; i++)
                {
                    //不存在则添加到删除记录列表
                    dr.Add(uid.Text + "," + ostr[i]);
                }
            }

            try
            {
                if (ar.Count != 0)
                {
                    bll.AddUserRole(ar);
                }
                if (dr.Count != 0)
                {
                    bll.DeleteUserRole(dr);
                }
                pnlRole.Visible = false;
                lstRole.Items.Clear();
                foreach (ListItem item in lstSelectedRole.Items)
                {
                    lstRole.Items.Add(item);
                }
            }
            catch
            {
            }
        }
        else
        {
            JSHelper.Alert("请至少选择一个角色!", this);
        }
    }
コード例 #22
0
        private Func <object, object> GetFormat(DataColumn column)
        {
            var type = column.DataType;

            if (type == typeof(int) || type == typeof(int?))
            {
                return(o =>
                {
                    if (o == null)
                    {
                        return 0;
                    }
                    var tempType = o.GetType();
                    if (tempType == typeof(int) || tempType == typeof(int?))
                    {
                        return o;
                    }
                    return TypeParse.StrToInt(o);
                });
            }
            else if (type == typeof(decimal) || type == typeof(decimal?) ||
                     type == typeof(short) || type == typeof(short?) ||
                     type == typeof(long) || type == typeof(long?) ||
                     type == typeof(float) || type == typeof(float?) ||
                     type == typeof(double) || type == typeof(double?))
            {
                return(o =>
                {
                    if (o == null)
                    {
                        return 0;
                    }
                    var tempType = o.GetType();
                    if (tempType == typeof(decimal) || tempType == typeof(decimal?))
                    {
                        return o;
                    }
                    return TypeParse.StrToDecimal(o, 0);
                });
            }
            else if (type == typeof(DateTime) || type == typeof(DateTime?))
            {
                return(o =>
                {
                    if (o == null)
                    {
                        return column.AllowDBNull ? DateTime.Now : (DateTime?)null;
                    }
                    var tempType = o.GetType();
                    if (tempType == typeof(DateTime) || tempType == typeof(DateTime?))
                    {
                        return o;
                    }
                    return column.AllowDBNull ? TypeParse.ConvertToDateTime(o) : TypeParse.ConvertToNullableDateTime(o);
                });
            }
            else if (type == typeof(string))
            {
                return(o =>
                {
                    if (o == null)
                    {
                        return string.Empty;
                    }
                    var tempType = o.GetType();
                    if (tempType == typeof(string))
                    {
                        return o;
                    }
                    return o.ToString();
                });
            }
            return(x => Convert.ChangeType(x, type));
        }
コード例 #23
0
 /// <summary>
 /// 根据键值从HTTP查询字符串变量集合中获取Int值
 /// </summary>
 /// <param name="context"></param>
 /// <param name="key"></param>
 /// <returns></returns>
 public static int GetIntFromQueryString(this HttpContext context, string key)
 {
     return(TypeParse.StrToInt(context.Request.QueryString[key]));
 }
コード例 #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int allcount   = user.getusernumbydate(0);
                int yearcount  = user.getusernumbydate(1);
                int monthcount = user.getusernumbydate(2);
                int daycount   = user.getusernumbydate(3);
                usertjHTML = "总会员:<span class=\"red\">" + allcount + "</span>个&nbsp;今年注册<span class=\"red\">" + yearcount + "</span>个&nbsp;本月注册<span class=\"red\">" + monthcount + "</span>个&nbsp;今日注册<span  class=\"red\">" + daycount + "</span>个&nbsp;";

                //账号类型
                List <userinfo> alist     = user.getaccountstype();
                StringBuilder   aselectsb = new StringBuilder();
                aselectsb.Append("<select id=\"atselect\" style=\"width:100px; border:solid 1px #cacaca; height:20px;z-index:100;\">");
                foreach (userinfo item in alist)
                {
                    string template = "<option value=\"{0}\">{1}</option>";
                    aselectsb.AppendFormat(template, item.atid, item.accountstype);
                }
                aselectsb.Append("</select>");
                atHTML = aselectsb.ToString();


                pageinfo pdata = new pageinfo();
                int      page;
                if (Request.QueryString["page"] != null)
                {
                    page = TypeParse.DbObjToInt(Request.QueryString["page"].ToString(), 1);
                }
                else
                {
                    page = 1;
                }

                pdata.curpageindex = page;
                pdata.pagesize     = 10;
                if (Request.QueryString["uinfo"] != null)
                {
                    string uinfo = HttpUtility.UrlDecode(Request.QueryString["uinfo"].ToString());
                    pdata.where = "userinfo.atid=accountstype.atid and ( userinfo.accounts like'%" + uinfo + "%' or userinfo.email like '%" + uinfo + "%')";
                }
                else if (Request.QueryString["atid"] != null)
                {
                    pdata.where = "userinfo.atid=accountstype.atid and userinfo.atid=" + Request.QueryString["atid"].ToString();
                }
                else
                {
                    pdata.where = "userinfo.atid=accountstype.atid";
                }
                pdata.recordcount    = allcount;
                pdata.tablename      = "userinfo,accountstype";
                pdata.fieldlist      = "userinfo.userid,userinfo.accounts,userinfo.email,userinfo.tel,userinfo.truename,userinfo.qq,userinfo.atid,userinfo.headerimg,userinfo.address,userinfo.mobile,userinfo.company,userinfo.adddate,accountstype.accountstype";
                pdata.sorttype       = 2;
                pdata.primarykey     = "userid";
                pdata.totalpagecount = (pdata.recordcount % pdata.pagesize == 0 ? pdata.recordcount / pdata.pagesize : pdata.recordcount / pdata.pagesize + 1);
                if (pdata.totalpagecount == 0)
                {
                    pdata.totalpagecount = 1;
                }

                List <userinfo> userlist = user.getUserList(pdata);

                StringBuilder sb = new StringBuilder();
                foreach (userinfo item in userlist)
                {
                    string template = "<tr><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\" >{0}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\">{1}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\">{2}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\">{3}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\">{4}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\">{5}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"left\" style=\"padding:0 0 0 2px;\">{6}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\">{7}</div></td><td height=\"20\" bgcolor=\"#FFFFFF\"><div align=\"center\"><a href=\"javascript:edituser('{8}')\" style=\"color:blue;cursor:pointer;\">编辑</a> | <a href=\"javascript:deluser('{9}','{10}')\" style=\"color:blue;cursor:pointer;\">删除</a></div></td></tr>";
                    sb.AppendFormat(template, item.adddate, item.email, item.accounts, item.truename, item.tel, item.mobile, item.company, item.accountstype, item.userid, item.userid, pdata.curpageindex);
                }
                userlistHTML = sb.ToString();
                pageHTML     = pagehelper.Pager(pdata.curpageindex, pdata.pagesize, pdata.recordcount, PageMode.Numeric, 5);
            }
        }
コード例 #25
0
ファイル: EditRole.aspx.cs プロジェクト: chcyellow/SEPkuang
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (lstSelectedRole.Items.Count > 0)
        {
            foreach (var uid in (List <object>)Session["UserIDList"])
            {
                txtTRole.Text = "";
                BindRole(uid.ToString());
                foreach (ListItem item in lstSelectedRole.Items)
                {
                    txtTRole.Text += item.Value + ",";
                }
                User          bll = new User();
                List <string> ar  = new List <string>(); //添加表
                List <string> dr  = new List <string>(); //删除表
                string        s   = txtTRole.Text;
                if (s != "")
                {
                    string[] str  = s.Substring(0, s.Length - 1).Split(',');
                    string[] ostr = txtOldRole.Text.ToString().Split(',');
                    for (int i = 0; i < str.Length; i++)
                    {
                        if (!TypeParse.IsStringArray(str[i], ostr))
                        {
                            //不存在则添加到插入记录列表
                            ar.Add(uid.ToString() + "," + str[i]);
                        }
                    }

                    for (int i = 0; i < ostr.Length; i++)
                    {
                        if (!TypeParse.IsStringArray(ostr[i], str))
                        {
                            //不存在则添加到删除记录列表
                            dr.Add(uid.ToString() + "," + ostr[i]);
                        }
                    }
                }
                else
                {
                    //如果提交角色为空则删除该用户的所有角色
                    string[] ostr = txtOldRole.Text.ToString().Split(',');
                    for (int i = 0; i < ostr.Length; i++)
                    {
                        //不存在则添加到删除记录列表
                        dr.Add(uid.ToString() + "," + ostr[i]);
                    }
                }

                try
                {
                    if (ar.Count != 0)
                    {
                        bll.AddUserRole(ar);
                    }
                    if (dr.Count != 0)
                    {
                        bll.DeleteUserRole(dr);
                    }
                    JSHelper.AlertAndCloseModalWin("更新成功!", this);
                }
                catch
                {
                    JSHelper.Alert("角色修改失败!", this);
                }
            }
        }
        else
        {
            JSHelper.Alert("请至少选择一个角色!", this);
        }
    }
コード例 #26
0
 /// <summary>
 /// 获得指定表单参数的int类型值
 /// </summary>
 /// <param name="strName">表单参数</param>
 /// <param name="defValue">缺省值</param>
 /// <returns>表单参数的int类型值</returns>
 public static int GetFormInt(string strName, int defValue)
 {
     return(TypeParse.StrToInt(HttpContext.Current.Request.Form[strName], defValue));
 }
コード例 #27
0
ファイル: AnaResult.aspx.cs プロジェクト: bigbigwood/daan
        //保存编辑的值
        protected void btnTestResult_Click(object sender, EventArgs e)
        {
            highlightRows.Text = "";
            //没有选取行
            if (gvOrderTest.SelectedRowIndexArray.Count <int>() == 0)
            {
                MessageBoxShow("请选择检查项目!", MessageBoxIcon.Warning);
                return;
            }
            if (txtTestResult.Text.Trim() == "")
            {
                MessageBoxShow("请填写检验结果!");
                return;
            }
            //检查项列表
            List <Ordertest> ordertestLst = OrderTestData(orderUserInfo[0].ToString()).ToList <Ordertest>();
            //选中检查项详细
            List <object> objValue   = gvOrderTest.DataKeys[gvOrderTest.SelectedRowIndexArray[0]].ToList();
            var           testResult = ordertestLst.Find(c => c.Ordertestid == TypeParse.StrToDouble(objValue[0], 0));

            testResult.Testresult  = txtTestResult.Text.Trim();
            testResult.Isexception = chkIsexception.Checked ? "1" : "0";
            //testResult.Testresult = txtTestResult.Text.Trim();

            //高低提示
            switch (testResult.Testname)
            {
            case "体重":
                GetBMLHlflag(ordertestLst);
                break;

            case "身高":
                GetBMLHlflag(ordertestLst);
                break;

            case "收缩压":
                testResult.Hlhint = GetSBPlflag(testResult);
                //异常判断
                testResult.Isexception = testResult.Hlhint == "正常" ? "0" : "1";
                break;

            case "舒张压":
                testResult.Hlhint = GetDBPlflag(testResult);
                //异常判断
                testResult.Isexception = testResult.Hlhint == "正常" ? "0" : "1";
                break;

            default:
                break;
            }
            try
            {
                if (orderTestService.UpdateOrdertestResult(testResult))
                {
                    //绑定科室小结列表
                    gvOrderTest.DataSource = OrderTestData(orderUserInfo[0].ToString());
                    gvOrderTest.DataBind();
                    txtTestResult.Text = "";
                }
            }
            catch (Exception ex)
            {
                MessageBoxShow(ex.Message, MessageBoxIcon.Error);
            }
        }
コード例 #28
0
 /// <summary>
 /// 获得指定表单参数的float类型值
 /// </summary>
 /// <param name="strName">表单参数</param>
 /// <param name="defValue">缺省值</param>
 /// <returns>表单参数的float类型值</returns>
 public static float GetFormFloat(string strName, float defValue)
 {
     return(TypeParse.StrToFloat(HttpContext.Current.Request.Form[strName], defValue));
 }
コード例 #29
0
        /// <summary>
        /// 指定用户是否申请了保护
        /// </summary>
        /// <param name="strUserID"></param>
        /// <returns></returns>
        protected virtual bool IsApplyProtection(string strUserID, out AccountsProtect protectInfo)
        {
            int dwUserID = TypeParse.StrToInt(CWHEncryptNet.XorCrevasse(strUserID), 0);

            return(IsApplyProtection(dwUserID, out protectInfo));
        }
コード例 #30
0
ファイル: AddNews.aspx.cs プロジェクト: lamjar/shop
        protected void AddNewsInfo(object sender, EventArgs e)
        {
            string uid = "";

            if (Request.Cookies["g_adminid"] != null)
            {
                uid = TypeParse.DbObjToString(Request.Cookies["g_adminid"].Value, "");
            }
            else
            {
                Response.Redirect("/Login/AdminLogin.aspx");
            }
            string uploadName = newsimg.Value; //获取待上传图片的完整路径,包括文件名
            //string uploadName = InputFile.PostedFile.FileName;
            string pictureName = "noimg.jpg";  //上传后的图片名,以当前时间为文件名,确保文件名没有重复

            if (newsimg.Value != "")
            {
                int    idx    = uploadName.LastIndexOf(".");
                string suffix = uploadName.Substring(idx);//获得上传的图片的后缀名
                if (suffix.ToLower() != ".bmp" && suffix.ToLower() != ".jpg" && suffix.ToLower() != ".jpeg" && suffix.ToLower() != ".png" && suffix.ToLower() != ".gif")
                {
                    imgnote.InnerHtml = "<span style=\"color:red\">上传文件必须是图片格式!</span>";
                    return;
                }
                pictureName = DateTime.Now.Ticks.ToString() + suffix;
            }
            try
            {
                if (uploadName != "")
                {
                    string path = Server.MapPath("/Files/NewsImages/");
                    newsimg.PostedFile.SaveAs(path + pictureName);
                }
                newsinfo data = new newsinfo();
                data.newstitle  = newstitle.Value.Trim();
                data.ntid       = TypeParse.DbObjToInt(ntID.SelectedValue, 0);
                data.istop      = TypeParse.DbObjToInt(istop.SelectedValue, 0);
                data.newsfrom   = newsfrom.Value.Trim();
                data.newswriter = newswriter.Value.Trim();
                data.newsnote   = newsnote.Value.Trim();
                data.userid     = uid;
                data.ninfo      = editor_id.Value;
                data.adddate    = DateTime.Now;
                data.newsimg    = pictureName;
                data.newsstate  = 1;

                bool result = news.addnews(data);
                if (result)
                {
                    Response.Write("<script>alert('添加新闻成功!');location.href='/Manager/NewsList.aspx';</script>");
                    return;
                }
                else
                {
                    Response.Write("<script>alert('添加新闻失败!');location.href='/Manager/NewsList.aspx';</script>");
                    return;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }