Пример #1
0
        /// <summary>
        /// 根据UserId
        /// </summary>
        /// <param name="strId"></param>
        /// <returns></returns>
        public int DelDictuserandlabByUserID(string strId)
        {
            int nflag = 0;

            try
            {
                var arrayId = strId.Split(',');
                //临时存储待删除对象,备写日志用
                List <Dictuserandlab> dictLibraryList = new List <Dictuserandlab>();
                foreach (string strid in arrayId)
                {
                    dictLibraryList.Add(GetDictuserandlabById(Convert.ToDouble(strid)));
                }
                nflag = this.delete("Dict.DeleteDictuserandlabByUserId", strId);
                foreach (Dictuserandlab item in dictLibraryList)
                {
                    Dictlab dictlab = new Dictlab();
                    dictlab.Dictlabid = item.Dictlabid;
                    dictlab           = new DictlabService().GetDictlabInfo(dictlab);
                    AddMaintenanceLog("Dictuserandlab", item.Dictuserandlabid, null, "删除", dictlab.Labname, item.Createdate.ToString(), modulename);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(nflag);
        }
Пример #2
0
        private void BindLab()
        {
            comLab.Items.Clear();
            List <Dictlab> lablist = new List <Dictlab>();
            Dictlab        lab1    = new Dictlab();

            lab1.Labname   = "全部";
            lab1.Dictlabid = -1;
            //List<Dictlab> lablist = loginservice.GetLoginDictlab();
            //lablist.Insert(0, lab);
            //comLab.DataSource = lablist;
            //comLab.DisplayMember = "Labname";
            //comLab.ValueMember = "Dictlabid";
            lablist.Add(lab1);
            //lablist.Insert(0, lab1);
            Dictlab lab2 = new Dictlab()
            {
                Labname = "济南实验室", Dictlabid = 48
            };

            lablist.Add(lab2);
            //lablist.Insert(1, lab2);
            Dictlab lab3 = new Dictlab()
            {
                Labname = "其他实验室", Dictlabid = 2
            };

            lablist.Add(lab3);
            //lablist.Insert(2, lab3);
            comLab.DataSource    = lablist;
            comLab.DisplayMember = "Labname";
            comLab.ValueMember   = "Dictlabid";
        }
Пример #3
0
        public static LabInfo ToLabInfo(this Dictlab domainDictlab)
        {
            if (domainDictlab == null)
            {
                return(null);
            }

            var model = new LabInfo();

            model.Id             = domainDictlab.Dictlabid.HasValue ? (int)domainDictlab.Dictlabid : 0;
            model.Name           = domainDictlab.Labname;
            model.EnglishName    = domainDictlab.Esitename;
            model.Description    = domainDictlab.Labdescription;
            model.Address        = domainDictlab.Addres;
            model.Zipcode        = domainDictlab.Zpcode;
            model.City           = domainDictlab.City;
            model.CityCode       = domainDictlab.Labcode;
            model.ContractNumber = domainDictlab.Phone;
            model.ContractMan    = domainDictlab.Contactman;
            model.Fax            = domainDictlab.Fax;
            model.LabImagePath   = domainDictlab.Labimage;
            model.WebsiteUrl     = domainDictlab.Website;
            model.DisplayOrder   = domainDictlab.Displayorder.HasValue ? (int)domainDictlab.Displayorder : 0;
            model.IsActive       = domainDictlab.IsActive == '1';

            return(model);
        }
Пример #4
0
 protected void btnDelAll_Click(object sender, EventArgs e)
 {
     try
     {
         StringBuilder sb = new StringBuilder();
         foreach (int row in gvList.SelectedRowIndexArray)
         {
             sb.Append(gvList.DataKeys[row][0].ToString());
             dictlab.Dictlabid = Convert.ToDouble(gvList.DataKeys[row][0].ToString());
             dictlab           = dictlabService.GetDictlabInfo(dictlab);
             string pictureUrl = Server.MapPath("../../upload/" + dictlab.Labimage);
             //判断文件是否存在
             if (File.Exists(pictureUrl))
             {
                 File.Delete(pictureUrl);//删除原文件
             }
             sb.Append(",");
         }
         var library = new DictlabService();
         int nflag   = library.DelDictlabByID(sb.ToString().TrimEnd(','));
         if (nflag > 0)
         {
             MessageBoxShow("所选项已成功删除", MessageBoxIcon.Information);
             BindGrid();
             dictlabId = 0;
             LoadEditDate();
         }
         CacheHelper.RemoveAllCache("daan.GetDictlab");
     }
     catch (Exception ex)
     {
         MessageBoxShow(ex.Message);
     }
 }
Пример #5
0
 /// <summary>
 /// 获取分点详细信息
 /// </summary>
 /// <param name="usercode"></param>
 /// <returns></returns>
 public Dictlab GetDictlabInfo(Dictlab library)
 {
     //Dictlab obj = null;
     //IList lst = this.selectIList("Dict.GetDictlabInfo", library);
     //if (lst.Count > 0)
     //    obj = (Dictlab)lst[0];
     //return obj;
     return(this.selectObj <Dictlab>("Dict.GetDictlabInfo", library));
 }
Пример #6
0
        private void BindLab()
        {
            Dictlab lab = new Dictlab();

            lab.Labname   = "全部";
            lab.Dictlabid = -1;
            List <Dictlab> lablist = loginservice.GetLoginDictlab();

            lablist.Insert(0, lab);
            comLab.DataSource    = lablist;
            comLab.DisplayMember = "Labname";
            comLab.ValueMember   = "Dictlabid";
        }
Пример #7
0
        ///<summary>
        ///新增编辑后保存
        ///</summary>
        ///<param name="library"></param>
        /// <returns></returns>
        public bool SaveDictuserandlab(Dictuserandlab library)
        {
            int nflag = 0;

            //新增
            if (library.Dictuserandlabid == 0 || library.Dictuserandlabid == null)
            {
                try
                {
                    library.Dictuserandlabid = getSeqID("SEQ_DICTUSERANDLAB");
                    insert("Dict.InsertDictuserandlab", library);
                    nflag = 1;
                    List <LogInfo> logLst  = getLogInfo <Dictuserandlab>(new Dictuserandlab(), library);
                    Dictlab        dictlab = new Dictlab();
                    dictlab.Dictlabid = library.Dictlabid;
                    dictlab           = new DictlabService().GetDictlabInfo(dictlab);
                    AddMaintenanceLog("Dictuserandlab", int.Parse(library.Dictuserandlabid.ToString()), logLst, "新增", dictlab.Labname, library.Createdate.ToString(), modulename);
                }
                catch (Exception ex)
                {
                    nflag = 0;
                    throw new Exception(ex.Message);
                }
            }
            else//保存
            {
                try
                {
                    Dictuserandlab dictcustomer = GetDictcustomeridInfo(library);
                    nflag = update("Dict.UpdateDictuserandlab", library);
                    List <LogInfo> logLst  = getLogInfo <Dictuserandlab>(dictcustomer, library);
                    Dictlab        dictlab = new Dictlab();
                    dictlab.Dictlabid = library.Dictlabid;
                    dictlab           = new DictlabService().GetDictlabInfo(dictlab);
                    AddMaintenanceLog("Dictuserandlab", int.Parse(library.Dictuserandlabid.ToString()), logLst, "修改", dictlab.Labname, library.Createdate.ToString(), modulename);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
            return(nflag > 0);
        }
Пример #8
0
        ///<summary>
        ///新增编辑后保存
        ///</summary>
        ///<param name="library"></param>
        /// <returns></returns>
        public bool SaveDictlab(Dictlab library)
        {
            int nflag = 0;

            //新增
            if (library.Dictlabid == 0 || library.Dictlabid == null)
            {
                try
                {
                    library.Dictlabid = getSeqID("SEQ_DICTLAB");
                    insert("Dict.InsertDictlab", library);
                    nflag = 1;
                    List <LogInfo> logLst = getLogInfo <Dictlab>(new Dictlab(), library);
                    AddMaintenanceLog("Dictlab", int.Parse(library.Dictlabid.ToString()), logLst, "新增", library.Labname, library.Addres, modulename);
                    CacheHelper.RemoveAllCache("daan.GetDictlab");
                }
                catch (Exception ex)
                {
                    nflag = 0;
                    throw new Exception(ex.Message);
                }
            }
            else//保存
            {
                try
                {
                    Dictlab dictlab = GetDictlabInfo(library);
                    nflag = update("Dict.UpdateDictlab", library);
                    List <LogInfo> logLst = getLogInfo <Dictlab>(dictlab, library);
                    AddMaintenanceLog("Dictlab", int.Parse(library.Dictlabid.ToString()), logLst, "修改", library.Labname, library.Addres, modulename);
                    CacheHelper.RemoveAllCache("daan.GetDictlab");
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
            CacheHelper.RemoveAllCache("daan.GetDictlab");
            return(nflag > 0);
        }
Пример #9
0
        //保存数据的逻辑
        public bool SaveDictlibrary()
        {
            try
            {
                string fileName = "";
                #region //上传大图
                if (this.FileUp.HasFile)
                {
                    fileName = new FileInfo(FileUp.FileName).Name;                         //文件名称
                    string type = fileName.Substring(fileName.IndexOf(".") + 1).ToLower(); //文件的格式
                    //判断文件格式
                    if (type != ("jpg") && type != ("gif") && type != ("png") && type != ("jpeg") && type != ("bmp"))
                    {
                        errorType = "上传图片格式不正确!";
                        return(false);
                    }
                    if (dictlab.Dictlabid == 0)
                    {
                        fileName = UploadPhoto(this.FileUp);//上传文件
                    }
                    else
                    {
                        dictlab = dictlabService.GetDictlabInfo(dictlab);
                        string pictureUrl = Server.MapPath("../../upload/" + dictlab.Labimage);
                        fileName = UploadPhoto(this.FileUp);//上传文件
                        //判断文件是否存在
                        if (File.Exists(pictureUrl))
                        {
                            File.Delete(pictureUrl); //删除原文件
                        }
                        dictlab.Labimage = fileName; //修改新的文件名
                    }
                }
                #endregion
                if (this.tbxADDRES.Text.Trim() != "")
                {
                    dictlab.Addres = this.tbxADDRES.Text.Trim();
                }
                else
                {
                    errorType = "地址不能为空!";
                    return(false);
                }
                if (this.dropShi.SelectedValue != "-1")
                {
                    dictlab.City = this.dropSheng.SelectedValue + "," + this.dropShi.SelectedValue;
                }
                else
                {
                    errorType = "下拉框数据出错!";
                    return(false);
                }
                dictlab.Contactman   = this.tbxCONTACTMAN.Text.Trim();
                dictlab.Displayorder = Convert.ToInt32(this.tbxDISPLAYORDER.Text.Trim() == "" ? 0 : Convert.ToInt32(this.tbxDISPLAYORDER.Text.Trim()));
                if (this.tbxLABNAME.Text.Trim() != "")
                {
                    dictlab.Labname = this.tbxLABNAME.Text.Trim();
                }
                else
                {
                    errorType = "分点名称不能为空!";
                    return(false);
                }
                if (this.tbxPHONE.Text.Trim() != "")
                {
                    dictlab.Phone = this.tbxPHONE.Text.Trim();
                }
                else
                {
                    errorType = "联系电话不能为空!";
                    return(false);
                }
                dictlab.Zpcode         = this.tbxZPCODE.Text.Trim();
                dictlab.Labdescription = this.Txa.Text.Trim();
                dictlab.Website        = this.tbxWebSite.Text.Trim();
                if (this.tbxLabCode.Text.Trim() != "")
                {
                    dictlab.Labcode = this.tbxLabCode.Text.Trim();
                }
                else
                {
                    errorType = "分点简称不能为空!";
                    return(false);
                }

                dictlab.Esitename = this.tbxEsiteName.Text.Trim();
                dictlab.Fax       = this.tbxFax.Text.Trim();
                if (dictlab.Dictlabid == 0)
                {
                    if (FileUp.FileName != "")
                    {
                        dictlab.Labimage = "labUploadFiles/" + fileName;
                    }
                    else
                    {
                        errorType = "请上传图片!";
                        return(false);
                    }
                }
                else
                {
                    if (FileUp.FileName != "")
                    {
                        dictlab.Labimage = "labUploadFiles/" + fileName;
                    }
                    else
                    {
                        Dictlab di = new DictlabService().GetDictlabInfo(dictlab);
                        dictlab.Labimage = di.Labimage;
                    }
                }
                return(dictlabService.SaveDictlab(dictlab));
            }
            catch (Exception ex)
            {
                MessageBoxShow(ex.Message);
                return(false);
            }
        }
Пример #10
0
        private void LoadEditDate()
        {
            dictlab.Dictlabid = dictlabId;
            Dictlab dictlabfo = new DictlabService().GetDictlabInfo(dictlab);

            BindSheng();
            BindShi();
            if (dictlabfo == null)
            {
                dictlab = new Dictlab();
                SimpleFormEdit.Title      = "当前状态-新增";
                this.tbxADDRES.Text       = dictlab.Addres;
                this.tbxCONTACTMAN.Text   = dictlab.Contactman;
                this.tbxDISPLAYORDER.Text = dictlab.Displayorder.ToString();
                this.tbxLABNAME.Text      = dictlab.Labname;
                this.tbxPHONE.Text        = dictlab.Phone;
                this.tbxZPCODE.Text       = dictlab.Zpcode;
                if (dictlab.City != null)
                {
                    string type = dictlab.City.Substring(0, dictlab.City.LastIndexOf(","));
                    dropSheng.SelectedValue = type;
                    dropSheng_SelectedIndexChanged(Page, EventArgs.Empty);
                    string shiType = dictlab.City.Substring(dictlab.City.IndexOf(",") + 1);
                    dropShi.SelectedValue = shiType;
                }
                else
                {
                    this.dropSheng.SelectedItem.Value = "-1";
                    dropSheng_SelectedIndexChanged(Page, EventArgs.Empty);
                    this.dropShi.SelectedValue = "";
                }
                this.imgA.Visible = true;
                if (dictlab.Labimage != null)
                {
                    this.imgA.ImageUrl = "../../upload/" + dictlab.Labimage;
                }
                else
                {
                    this.imgA.ImageUrl = "../../images/NoPictures.jpg";
                }
                this.tbxFax.Text       = dictlab.Fax;
                this.tbxEsiteName.Text = dictlab.Esitename;
                this.tbxLabCode.Text   = dictlab.Labcode;
                this.tbxWebSite.Text   = dictlab.Website;
                this.Txa.Text          = dictlab.Labdescription;
            }
            else
            {
                this.tbxADDRES.Text       = dictlabfo.Addres;
                this.tbxCONTACTMAN.Text   = dictlabfo.Contactman;
                this.tbxDISPLAYORDER.Text = dictlabfo.Displayorder.ToString();
                this.tbxLABNAME.Text      = dictlabfo.Labname;
                this.tbxPHONE.Text        = dictlabfo.Phone;
                this.tbxZPCODE.Text       = dictlabfo.Zpcode;
                if (dictlabfo.City != null)
                {
                    string type = dictlabfo.City.Substring(0, dictlabfo.City.LastIndexOf(","));
                    dropSheng.SelectedValue = type;
                    dropSheng_SelectedIndexChanged(Page, EventArgs.Empty);
                    string shiType = dictlabfo.City.Substring(dictlabfo.City.IndexOf(",") + 1);
                    dropShi.SelectedValue = shiType;
                }
                else
                {
                    this.dropSheng.SelectedValue = "-1";
                    dropSheng_SelectedIndexChanged(Page, EventArgs.Empty);
                    this.dropShi.SelectedValue = "";
                }
                this.imgA.Visible = true;
                if (dictlabfo.Labimage != null)
                {
                    this.imgA.ImageUrl = "../../upload/" + dictlabfo.Labimage;
                }
                else
                {
                    this.imgA.ImageUrl = "../../images/NoPictures.jpg";
                }
                //if (dictlab.Labimage == null)
                //{
                //    this.FileUp. = "";
                //}
                //this.FileUp.Text = dictlab.Labimage;
                this.tbxFax.Text       = dictlabfo.Fax;
                this.tbxEsiteName.Text = dictlabfo.Esitename;
                this.tbxLabCode.Text   = dictlabfo.Labcode;
                this.tbxWebSite.Text   = dictlabfo.Website;
                this.Txa.Text          = dictlabfo.Labdescription;
            }
        }