Esempio n. 1
0
        /// <summary>
        /// 同步用户
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSynchronous_Click(object sender, EventArgs e)
        {
            //同步系统用户获取系统下所有用户信息
            List <UserInUserInfo> userinfo = SecurityHandler.LoginOn(Request.Cookies.Get("authorizationcode").Value.ToString()).GetUserInfoList();
            //本地用户
            List <Dictuser> allUser           = new DictuserService().GetDictuser().ToList();
            Dictionary <string, Dictuser> map = new Dictionary <string, Dictuser>();

            for (int i = 0; i < allUser.Count; i++)
            {
                map.Add(allUser[i].Usercode, allUser[i]);
            }
            #region 用户数据更新
            foreach (UserInUserInfo sysu in userinfo)
            {
                if (map.ContainsKey(sysu.USERNAME))
                {
                    Dictuser newUser = map[sysu.USERNAME];
                    if (sysu.ECHONAME != null)
                    {
                        newUser.Username = sysu.ECHONAME;
                    }
                    if (sysu.PASSWORD != null)
                    {
                        newUser.Password = sysu.PASSWORD;
                    }
                    try
                    {
                        new DictuserService().SaveDictlab(newUser);
                    }
                    catch (Exception ex)
                    {
                        MessageBoxShow(ex.Message, MessageBoxIcon.Error);
                        return;
                    }
                }
                else
                {
                    try
                    {
                        Dictuser newUser = new Dictuser();
                        newUser.Username      = sysu.ECHONAME;
                        newUser.Usercode      = sysu.USERNAME;
                        newUser.Password      = sysu.PASSWORD;
                        newUser.Dictlabid     = 0;
                        newUser.Dictlabdeptid = 0;
                        newUser.Active        = "1";
                        new DictuserService().SaveDictlab(newUser);
                    }
                    catch (Exception ex)
                    {
                        MessageBoxShow(ex.Message, MessageBoxIcon.Error);
                        return;
                    }
                }
            }
            MessageBoxShow("用户已同步!", MessageBoxIcon.Information);
            BindGrid();
            #endregion
        }
Esempio n. 2
0
 //保存数据的逻辑
 public bool SaveDictlibrary()
 {
     try
     {
         Dictuser user = new DictuserService().GetDictuserInfo(dictuser);
         if (this.Drop_Dictlab.SelectedValue != "-1")
         {
             user.Dictlabid = Convert.ToDouble(this.Drop_Dictlab.SelectedValue);
         }
         else
         {
             erreyType = "分点不能为空!";
             return(false);
         }
         if (this.Drop_DictLabDepTid.SelectedValue != "-1")
         {
             user.Dictlabdeptid = Convert.ToDouble(this.Drop_DictLabDepTid.SelectedValue);
         }
         else
         {
             erreyType = "实验室不能为空!";
             return(false);
         }
         user.Active = this.radlIsactive.SelectedValue;
         return(new DictuserService().SaveDictlab(user));
     }
     catch (Exception ex)
     {
         MessageBoxShow(ex.Message, MessageBoxIcon.Error);
         return(false);
     }
 }
Esempio n. 3
0
        private void BindDrop()
        {
            try
            {
                List <Dictlab> dictlab = new DictlabService().GetDictlabList();
                this.Drop_Dictlab.DataSource     = dictlab;
                this.Drop_Dictlab.DataTextField  = "Labname";
                this.Drop_Dictlab.DataValueField = "Dictlabid";
                this.Drop_Dictlab.DataBind();
                this.Drop_Dictlab.Items.Insert(0, new ExtAspNet.ListItem("请选择", "-1"));

                this.Drop_DictLabDepTid.DataSource     = new LoginService().GetLoginDictlabdeptList();
                this.Drop_DictLabDepTid.DataTextField  = "Labdeptname";
                this.Drop_DictLabDepTid.DataValueField = "Dictlabdeptid";
                this.Drop_DictLabDepTid.DataBind();
                Drop_DictLabDepTid.Items.Insert(0, new ExtAspNet.ListItem("请选择", "-1"));

                dictuser.Dictuserid = DictUserId;
                Dictuser user = new DictuserService().GetDictuserInfo(dictuser);
                this.Drop_Dictlab.SelectedValue       = user.Dictlabid.ToString();
                this.Drop_DictLabDepTid.SelectedValue = user.Dictlabdeptid.ToString();
                this.radlIsactive.SelectedValue       = user.Active;
            }
            catch (Exception ex)
            {
                MessageBoxShow(ex.Message, MessageBoxIcon.Error);
            }
        }
Esempio n. 4
0
        public AuthorizeResponse Process(AuthorizeRequest request)
        {
            var response = new AuthorizeResponse()
            {
                ResultType = ResultTypes.Ok
            };

            var dictUser = new Dictuser()
            {
                Usercode = request.Username
            };

            dictUser = new DictuserService().GetDictuserInfoByUserCode(dictUser);
            if (dictUser == null)
            {
                response.ResultType = ResultTypes.DataValidationError;
                response.Messages   = new[] { string.Format("Cannot find dictUser by username={0}", request.Username) };
                return(response);
            }

            var domainUserInfo = new daan.domain.UserInfo();

            domainUserInfo.userCode      = dictUser.Usercode;
            domainUserInfo.userName      = dictUser.Username;
            domainUserInfo.userId        = Convert.ToInt32(dictUser.Dictuserid);
            domainUserInfo.loginTime     = DateTime.Now;
            domainUserInfo.joinLabidstr  = dictUser.Joinlabid;
            domainUserInfo.dictlabid     = dictUser.Dictlabid;
            domainUserInfo.joinDeptstr   = dictUser.Joindeptid;
            domainUserInfo.dictlabdeptid = dictUser.Dictlabdeptid;

            bool           enablePermissionControl = true;
            LoginService   loginservice            = new LoginService();
            List <Dictlab> lablist = new List <Dictlab>();

            if (enablePermissionControl)
            {
                lablist = loginservice.GetPermissionDictlab(domainUserInfo);
            }
            else
            {
                lablist = loginservice.GetLoginDictlab();
            }
            response.LabAssociations = lablist.Select(l => l.ToLabInfo()).ToArray();

            var dictAllCustomerList = loginservice.GetDictcustomer();

            response.OrganizationAssociations = dictAllCustomerList.Select(c => c.ToOrganizationInfo()).ToArray();

            DictreporttemplateService dictreporttemplateService = new DictreporttemplateService();
            var dictReportTemplates = dictreporttemplateService.GetDictreporttemplateAll();

            response.ReportTemplates = dictReportTemplates.Select(r => r.ToReportTemplateInfo()).ToArray();

            return(response);
        }
Esempio n. 5
0
        private bool AutoUploadFile(DataTable dt, DataRow headerDr)
        {
            double?Orderfileheaderid = Convert.ToDouble(headerDr["Orderfileheaderid"]);
            double?enterby           = Convert.ToDouble(headerDr["enterby"]);
            double?dictcustormer     = Convert.ToDouble(headerDr["dictcustormer"]);
            double?dictlabid         = Convert.ToDouble(headerDr["dictlabid"]);
            string province          = headerDr["province"].ToString();
            string city          = headerDr["city"].ToString();
            string county        = headerDr["county"].ToString();
            bool   isunifiedpost = false;

            if (headerDr["isunifiedpost"].ToString() == "1")
            {
                isunifiedpost = true;
            }
            string postaddress   = headerDr["postaddress"].ToString();
            string recipient     = headerDr["recipient"].ToString();
            string contactnumber = headerDr["contactnumber"].ToString();

            DictuserService userService = new DictuserService();
            string          username    = userService.GetDictuserInfoAuto(enterby).Username;
            Orderfiledetail filedetail  = new Orderfiledetail();
            Orderfileheader fileheader  = new Orderfileheader()
            {
                Orderfileheaderid = Orderfileheaderid, Status = 1
            };

            //bool isCacheData = true;
            //string conTestCode = ConfigurationManager.AppSettings["NoCacheTestCode"];
            //List<Dicttestitem> TestItemList = loginservice.GetLoginDicttestitemListNoCache();//项目字典表
            List <Dictproductdetail> ProductDetail   = loginservice.GetLoginDictproductdetailNoCache();                               //套餐组合字典
            List <Dicttestitem>      productlistTemp = new DicttestitemService().GetProduct(TypeParse.StrToDouble(dictcustormer, 0)); //查询分点+公用套餐
            string _productname = string.Empty;

            for (int i = (dt.Rows.Count - 1); i >= 0; i--)
            {
                bool    b      = false;//添加是否成功
                string  errstr = "";
                DataRow dr     = dt.Rows[i];

                string productTestCode = dr["套餐代码"].ToString().Replace('_', ' ').Trim();
                string detailbarcode   = string.Empty;
                try
                {
                    detailbarcode = dr["条码号"].ToString().Replace('_', ' ').Trim();
                    if (detailbarcode != string.Empty)
                    {
                        Convert.ToDouble(detailbarcode);
                    }
                }
                catch (Exception) { }
                string mobile   = dr["手机"].ToString().Trim();
                string idnumber = dr["身份证"].ToString().Trim();
                string realname = dr["姓名"].ToString().Trim();
                if (string.IsNullOrEmpty(realname) || string.IsNullOrEmpty(productTestCode))
                {
                    filedetail.Reason            = "姓名、套餐代码不可以为空!";
                    filedetail.Status            = 0;
                    filedetail.Barcode           = detailbarcode;
                    filedetail.Orderfileheaderid = Orderfileheaderid;
                    filedetail.Createdate        = DateTime.Now;
                    filedetail.Realname          = realname;
                    filedetail.Mobile            = mobile;
                    filedetail.Idnumber          = idnumber;
                    detailservice.InsertOrderfiledetail(filedetail);
                    continue;
                }

                #region 条码号检查
                if (detailbarcode != string.Empty && detailbarcode.Length != 12)//条码号非12位
                {
                    filedetail.Reason            = string.Format("条码号[{0}]必须为12位数字,可以为空!", detailbarcode);
                    filedetail.Status            = 0;
                    filedetail.Barcode           = detailbarcode;
                    filedetail.Orderfileheaderid = Orderfileheaderid;
                    filedetail.Createdate        = DateTime.Now;
                    filedetail.Realname          = realname;
                    filedetail.Mobile            = mobile;
                    filedetail.Idnumber          = idnumber;
                    detailservice.InsertOrderfiledetail(filedetail);
                    continue;
                }
                if (detailbarcode != string.Empty && detailbarcode.Substring(detailbarcode.Length - 2) != "00")//条码号不以00结尾
                {
                    filedetail.Reason            = string.Format("此条码号[{0}]不是以00结尾,请更改条码号!", detailbarcode);
                    filedetail.Status            = 0;
                    filedetail.Barcode           = detailbarcode;
                    filedetail.Orderfileheaderid = Orderfileheaderid;
                    filedetail.Createdate        = DateTime.Now;
                    filedetail.Realname          = realname;
                    filedetail.Mobile            = mobile;
                    filedetail.Idnumber          = idnumber;
                    detailservice.InsertOrderfiledetail(filedetail);
                    continue;
                }
                if (barcodeservice.CheckBarCode(detailbarcode))//条码号存在
                {
                    filedetail.Reason            = string.Format("此条码号[{0}]已在本系统内生成,请更改条码号!", detailbarcode);
                    filedetail.Status            = 0;
                    filedetail.Barcode           = detailbarcode;
                    filedetail.Orderfileheaderid = Orderfileheaderid;
                    filedetail.Createdate        = DateTime.Now;
                    filedetail.Realname          = realname;
                    filedetail.Mobile            = mobile;
                    filedetail.Idnumber          = idnumber;
                    detailservice.InsertOrderfiledetail(filedetail);
                    continue;
                }
                #endregion

                string sex = "U";
                if (dr["性别"] != DBNull.Value && !string.IsNullOrEmpty(dr["性别"].ToString()))
                {
                    //if (dr["性别"].ToString() == "女")
                    //    sex = "F";
                    //else if (dr["性别"].ToString() == "男")
                    //    sex = "M";
                    sex = dr["性别"].ToString().Replace('_', ' ').Trim() == "女" ? "F" : (dr["性别"].ToString().Replace('_', ' ').Trim() == "男" ? "M" : "U");
                }

                List <Dicttestitem> productList   = productlistTemp.Where <Dicttestitem>(c => c.Testcode == productTestCode && (c.Forsex.ToUpper() == sex.ToUpper() || c.Forsex.ToUpper() == "B")).ToList <Dicttestitem>();
                List <Dicttestitem> grouptestList = new List <Dicttestitem>();
                Dicttestitem        productinfo   = null;
                if (productList.Count == 0)
                {
                    filedetail.Reason            = String.Format("套餐代码[{0}]无匹配项,请查看性别是否匹配或者是否有该套餐。", productTestCode);
                    filedetail.Status            = 0;
                    filedetail.Barcode           = detailbarcode;
                    filedetail.Orderfileheaderid = Orderfileheaderid;
                    filedetail.Createdate        = DateTime.Now;
                    filedetail.Realname          = realname;
                    filedetail.Mobile            = mobile;
                    filedetail.Idnumber          = idnumber;
                    detailservice.InsertOrderfiledetail(filedetail);
                    continue;
                }
                else if (productList.Count > 1)
                {
                    filedetail.Reason            = String.Format("存在多个套餐代码为[{0}]的套餐", productTestCode);
                    filedetail.Status            = 0;
                    filedetail.Barcode           = detailbarcode;
                    filedetail.Orderfileheaderid = Orderfileheaderid;
                    filedetail.Createdate        = DateTime.Now;
                    filedetail.Realname          = realname;
                    filedetail.Mobile            = mobile;
                    filedetail.Idnumber          = idnumber;
                    detailservice.InsertOrderfiledetail(filedetail);
                    continue;
                }
                else
                {
                    productinfo = productList[0];
                    if (productinfo.Testtype == "2")//公用套餐
                    {
                        _productname = productinfo.Testname.ToString().Replace("(公用套餐)", "");
                    }
                    else
                    {
                        _productname = productinfo.Testname;
                    }

                    //检验套餐中项目组合信息(性别是否相符;是否重复添加项目组合;项目是否维护分管原则、科室和标本类型)
                    string msg = registerservice.AddProductAuto(sex, productinfo, detailbarcode);
                    if (msg != string.Empty)
                    {
                        filedetail.Reason            = msg;
                        filedetail.Status            = 0;
                        filedetail.Barcode           = detailbarcode;
                        filedetail.Orderfileheaderid = Orderfileheaderid;
                        filedetail.Createdate        = DateTime.Now;
                        filedetail.Realname          = realname;
                        filedetail.Mobile            = mobile;
                        filedetail.Idnumber          = idnumber;
                        detailservice.InsertOrderfiledetail(filedetail);
                        continue;
                    }

                    //套餐下组合项目
                    IEnumerable <Dictproductdetail> IEgroup = ProductDetail.Where <Dictproductdetail>(c => c.Productid == productinfo.Dicttestitemid);

                    bool   iscontinue = true;
                    string msgdetail  = string.Empty;
                    foreach (Dictproductdetail item in IEgroup)
                    {
                        Dicttestitem groupinfo = registerservice.SelectDicttestitemByDicttestitemid(item.Testgroupid);
                        if (groupinfo == null)
                        {
                            msgdetail += string.Format("没有找到套餐[{0}]下ID为[{1}]的{2}[{3}]!", _productname, item.Testgroupid, groupinfo.Testtype == "0" ? "单项" : "组合", groupinfo.Testname) + ";";
                            iscontinue = false;
                            continue;
                        }
                        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 (detailbarcode == 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 = detailbarcode;
                        }
                        //获取外包客户
                        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)
                    {
                        if (!string.IsNullOrEmpty(msgdetail))
                        {
                            filedetail.Reason            = msgdetail;
                            filedetail.Status            = 0;
                            filedetail.Barcode           = detailbarcode;
                            filedetail.Orderfileheaderid = Orderfileheaderid;
                            filedetail.Createdate        = DateTime.Now;
                            filedetail.Realname          = realname;
                            filedetail.Mobile            = mobile;
                            filedetail.Idnumber          = idnumber;
                            detailservice.InsertOrderfiledetail(filedetail);
                        }
                        continue;
                    }
                }

                #region >>>>  不存在此会员添加会员

                Dictmember member = new Dictmember()
                {
                    Realname = realname, Idnumber = idnumber
                };
                //检查会员
                errstr = registerservice.checkmember(null, ref member);
                if (errstr != string.Empty)
                {
                    filedetail.Reason            = errstr;
                    filedetail.Status            = 0;
                    filedetail.Barcode           = detailbarcode;
                    filedetail.Orderfileheaderid = Orderfileheaderid;
                    filedetail.Createdate        = DateTime.Now;
                    filedetail.Realname          = realname;
                    filedetail.Mobile            = mobile;
                    filedetail.Idnumber          = idnumber;
                    detailservice.InsertOrderfiledetail(filedetail);
                    continue;
                }
                member.Nickname = member.Realname;
                member.Sex      = sex;
                DateTime datebirthday;
                bool     dateb = DateTime.TryParse(dr["出生日期"].ToString(), out datebirthday);
                if (dateb)
                {
                    member.Birthday = datebirthday;
                }
                member.Addres = dr["住址"].ToString().Trim();
                member.Phone  = dr["电话"].ToString().Trim();

                if (!string.IsNullOrWhiteSpace(dr["手机"].ToString().Trim()))
                {
                    double a;
                    bool   mobileb = double.TryParse(dr["手机"].ToString().Trim(), out a);
                    if (!mobileb)
                    {
                        filedetail.Reason            = "手机号码填写不正确,不要有特殊字符,[-]也不能包含";
                        filedetail.Barcode           = detailbarcode;
                        filedetail.Status            = 0;
                        filedetail.Orderfileheaderid = Orderfileheaderid;
                        filedetail.Createdate        = DateTime.Now;
                        filedetail.Realname          = realname;
                        filedetail.Mobile            = mobile;
                        filedetail.Idnumber          = idnumber;
                        detailservice.InsertOrderfiledetail(filedetail);
                        continue;
                    }
                }
                member.Mobile = dr["手机"].ToString().Trim();
                member.Email  = dr["邮箱"].ToString().Trim();
                #endregion

                #region >>>>  insert Orders

                double year = 0, month = 0, day = 0;
                double hours    = 0;//小时
                double age      = 0;
                string agestr   = dr["年龄"].ToString().Replace('_', ' ').Trim();
                string ageFiled = string.Empty;
                bool   ageb     = double.TryParse(agestr, out age);
                if (member.Birthday == null)
                {
                    if (agestr != string.Empty && ageb)
                    {
                        year            = age;
                        day             = age * 365;
                        member.Birthday = datebirthday = DateTime.Now.AddDays((0 - day));
                    }
                    else
                    {
                        filedetail.Reason            = "生日和年龄必须填写一项或者两项均填写错误";
                        filedetail.Barcode           = detailbarcode;
                        filedetail.Status            = 0;
                        filedetail.Orderfileheaderid = Orderfileheaderid;
                        filedetail.Createdate        = DateTime.Now;
                        filedetail.Realname          = realname;
                        filedetail.Mobile            = mobile;
                        filedetail.Idnumber          = idnumber;
                        detailservice.InsertOrderfiledetail(filedetail);
                        continue;
                    }
                }
                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;
                ageFiled = string.Format("{0}岁{1}月{2}日{3}时", year, month, day, 0);; //年龄字符串拼接 岁月日时

                Orders _orders = new Orders();
                _orders.Ordernum       = new ProRegisterService().GetOrderNum();; //体检流水号
                _orders.Remarks        = dr["备注"].ToString().Trim();              //备注
                _orders.Dictmemberid   = member.Dictmemberid;                     //会员ID
                _orders.Dictcustomerid = dictcustormer;                           //所属客户ID 界面选择
                _orders.Realname       = member.Realname;
                _orders.Sex            = member.Sex;                              //性别 对应INITBASIC表
                _orders.Caculatedage   = hours;                                   //计算后的年龄(小时为单位)
                _orders.Age            = ageFiled;
                _orders.Enterby        = username;                                //录入人
                _orders.Ordertestlst   = _productname + ",";                      //项目清单(冗余字段)
                _orders.Dictlabid      = dictlabid;                               //实验室分点
                _orders.Ordersource    = "1";                                     //单位上传 全是单位来源
                _orders.Ismarried      = dr["婚否"].ToString() == "未婚" ? "0" : (dr["婚否"].ToString() == "已婚" ? "1" : "2");
                _orders.Section        = dr["部门"].ToString().Trim();
                _orders.Status         = ((int)ParamStatus.OrdersStatus.BarCodePrint).ToString();
                DateTime samplingdate;
                bool     s = DateTime.TryParse(dr["采样日期"].ToString(), out samplingdate);
                if (s)
                {
                    TimeSpan timespan = DateTime.Now - samplingdate;
                    if (Math.Abs(timespan.Days) > 30)
                    {
                        filedetail.Reason            = "采样时间与当前时间相差不能超过一个月";
                        filedetail.Barcode           = detailbarcode;
                        filedetail.Status            = 0;
                        filedetail.Orderfileheaderid = Orderfileheaderid;
                        filedetail.Createdate        = DateTime.Now;
                        filedetail.Realname          = realname;
                        filedetail.Mobile            = mobile;
                        filedetail.Idnumber          = idnumber;
                        detailservice.InsertOrderfiledetail(filedetail);
                        continue;
                    }
                    _orders.SamplingDate = samplingdate;
                }

                _orders.Province = province;
                _orders.City     = city;
                _orders.County   = county;
                if (isunifiedpost)
                {
                    _orders.PostAddress   = postaddress;
                    _orders.Recipient     = recipient;
                    _orders.ContactNumber = contactnumber;
                }
                else
                {
                    _orders.PostAddress   = dr["住址"].ToString().Trim();
                    _orders.Recipient     = realname;
                    _orders.ContactNumber = dr["手机"].ToString().Trim();
                }

                _orders.Area        = dr["营业区"].ToString().Replace('_', ' ').Trim();
                _orders.BatchNumber = dr["场次号"].ToString().Replace('_', ' ').Trim();
                //add 20160530 增加客户经理字段
                if (dt.Columns.Contains("客户经理"))
                {
                    _orders.AccountManager = dr["客户经理"].ToString().Replace('_', ' ').Trim();
                }
                //add 20160612 增加本批标本总数字段
                if (dt.Columns.Contains("本批标本总数"))
                {
                    _orders.SpecimenCount = dr["本批标本总数"].ToString().Replace('_', ' ').Trim();
                }
                #endregion

                System.Collections.Hashtable htScan = new System.Collections.Hashtable();
                htScan.Add("isScan", true);
                htScan.Add("EnterByID", enterby);
                htScan.Add("EnterBy", username);
                b = registerservice.insertUpdateOrdersAuto("单位批量上传", "", true, productList, grouptestList, member, _orders, "", ref errstr, htScan);
                if (b)
                {
                    filedetail.Barcode           = detailbarcode;
                    filedetail.Reason            = "";
                    filedetail.Status            = 1;
                    filedetail.Orderfileheaderid = Orderfileheaderid;
                    filedetail.Createdate        = DateTime.Now;
                    filedetail.Realname          = realname;
                    filedetail.Mobile            = mobile;
                    filedetail.Idnumber          = idnumber;
                    detailservice.InsertOrderfiledetail(filedetail);
                }
                else
                {
                    filedetail.Barcode           = detailbarcode;
                    filedetail.Reason            = errstr + " 【Excel格式参照导入模版说明】";
                    filedetail.Status            = 0;
                    filedetail.Orderfileheaderid = Orderfileheaderid;
                    filedetail.Createdate        = DateTime.Now;
                    filedetail.Realname          = realname;
                    filedetail.Mobile            = mobile;
                    filedetail.Idnumber          = idnumber;
                    detailservice.InsertOrderfiledetail(filedetail);
                }
            }
            return(headerservice.UpdateOrderfileheader(fileheader));
        }
Esempio n. 6
0
        protected void btLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (Session["check"] == null)
                {
                    this.tbCaptcha.Text = string.Empty;
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", "<script language=\"javascript\">alert(\"验证码失效!\")</script>");
                    return;
                }
                if (tbCaptcha.Text != Session["check"].ToString())
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", "<script language=\"javascript\">alert(\"验证码错误!\")</script>");
                    this.tbCaptcha.Text = string.Empty;
                    return;
                }
                string usercode = Server.HtmlEncode(tbUserName.Text);
                string passWord = tbPassWord.Text;
                //进行用户登录,security.LoginResult为null或者security.LoginResult.IsPassed && security.LoginResult.AuthorizationCode != ""
                //都是登录失败
                SecurityHandler security = SecurityHandler.Login(usercode, passWord);
                if (security.LoginResult.SystemCode == null) //判断存不存在
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", "<script language=\"javascript\">alert(\"用户名或密码错误!\")</script>");
                    this.tbUserName.Text = string.Empty;
                    this.tbPassWord.Text = string.Empty;
                    this.tbCaptcha.Text  = string.Empty;
                    return;
                }
                var      aa   = SecurityHandler.LoginOn(security.LoginResult.AuthorizationCode).GetCurrentUserInfo();
                Dictuser user = new Dictuser();
                user.Usercode = aa.USERNAME;
                user          = new DictuserService().GetDictuserInfoByUserCode(user);
                if (user != null)
                {
                    UserInfo userInfo = new UserInfo();
                    userInfo.AuthorizationCode = security.LoginResult.AuthorizationCode;
                    userInfo.userCode          = user.Usercode;
                    userInfo.userName          = user.Username;
                    userInfo.userId            = Convert.ToInt32(user.Dictuserid);
                    userInfo.loginTime         = DateTime.Now;
                    userInfo.joinLabidstr      = user.Joinlabid;
                    userInfo.dictlabid         = user.Dictlabid;
                    userInfo.joinDeptstr       = user.Joindeptid;
                    userInfo.dictlabdeptid     = user.Dictlabdeptid;
                    userInfo.sysSetting        = GetSysSetting();
                    Session["UserInfo"]        = userInfo;
                }

                if (security.LoginResult.IsPassed && security.LoginResult.AuthorizationCode != "")
                {
                    //这里的Cookie名字不能更改
                    HttpCookie cookie = new HttpCookie("authorizationcode");
                    cookie.Value = security.LoginResult.AuthorizationCode;
                    TimeSpan ts = new TimeSpan(1, 0, 0, 0);
                    cookie.Expires = DateTime.Now.Add(ts);//添加作用时间
                    Response.AppendCookie(cookie);

                    if (!RegexPassWordSecurity(passWord))
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "redirectToChangePassword",
                                                           "<script> alert('您的密码安全性较弱,请重新修改密码'); window.location.href='EditPassword.aspx';</script>");

                        return;
                    }

                    Response.Redirect("Main.aspx", false);
                    //////PageContext.RegisterStartupScript("top.location.href = 'Main.aspx';");
                    //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", "<script language=\"javascript\">top.location.href = 'Main.aspx';</script>");
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "message", "<script language=\"javascript\">alert(\"用户名或密码错误!\")</script>");
                    this.tbUserName.Text = string.Empty;
                    this.tbPassWord.Text = string.Empty;
                    this.tbCaptcha.Text  = string.Empty;
                    return;
                }
            }
            catch (Exception ex)
            {
                Alert.ShowInTop(ex.Message, "体检系统");
            }
        }