Exemplo n.º 1
0
        protected void submit_Click(object sender, EventArgs e)
        {
            XtmUser userM = new XtmUser();

            userM.UserCode = this.txtUsername.Text.Trim();
            userM.UserPwd  = Encry.Encode(this.txtUserpwd.Text.Trim());
            BaseDao         baseDao = new BaseDao();
            IList <XtmUser> userL   = baseDao.List <XtmUser>(userM);

            if (userL != null && userL.Count > 0)
            {
                userM = userL[0];
                if (userM.Status != "x")
                {
                    Page.RegisterStartupScript("onclick", "<script>alert('账号已停用')</script>");
                }
                else
                {
                    CoreCache.SetCache("SysDepartId", userM.DepartId);
                    CoreCache.SetCache("SysUserType", userM.UserType);
                    CoreCache.SetCache("SysUserId", userM.Did);
                    CoreCache.SetCache("SysUserCode", userM.UserCode);
                    CoreCache.SetCache("SysUserName", userM.UserName);
                    Response.Redirect("Index/content.htm");
                }
            }
            else
            {
                Page.RegisterStartupScript("onclick", "<script>alert('账号或密码错误')</script>");
            }
        }
Exemplo n.º 2
0
        protected void Depart_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Depart.SelectedValue == "")
            {
                this.YwyCode.Items.Clear();
                this.YwyCode.SelectedValue = "";
            }
            else
            {
                BaseDao   baseDao = new BaseDao();
                Hashtable ht      = new Hashtable();
                XtmDepart de      = new XtmDepart();
                de.DepartCode = Depart.SelectedValue;
                IList <XtmDepart> depL = baseDao.List(de);
                if (depL != null && depL.Count > 0)
                {
                    ht.Add("depart", depL[0].Did);
                    WebUiProcess.InitDropDownList(this.YwyCode, "ddlCbYwy", ht, ref errmsg);
                }
            }


            //if (Depart.SelectedValue == "")
            //{
            //    this.YwyCode.Items.Clear();
            //    this.YwyCode.SelectedValue = "";
            //}
            //else
            //{
            //    Hashtable ht = new Hashtable();
            //    ht.Add("depart", Depart.SelectedValue);
            //    WebUiProcess.InitDropDownList(this.YwyCode, "ddlCbYwy", ht, ref errmsg);
            //}
        }
Exemplo n.º 3
0
        private IList <YwData> GetYwDataList()
        {
            YwData data = new YwData();
            //data.Dzh = "PDAA201635110000060776";
            IList <YwData> list = baseD.List(data);

            return(list);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 创建实体后期动作
 /// </summary>
 public override void AfterCreateEntity()
 {
     base.AfterCreateEntity();
     if (!IsPostBack)
     {
         BaseDao           baseDao = new BaseDao();
         XtmConfig         config  = new XtmConfig();
         IList <XtmConfig> list    = baseDao.List(config);
         if (list != null && list.Count > 0)
         {
             this.Entity = list[0];
         }
     }
 }
Exemplo n.º 5
0
        public IWorkbook ExportData(ref string errmsg)
        {
            XtmUser      param = new XtmUser();
            XSSFWorkbook book  = new XSSFWorkbook();
            ISheet       sheet = book.CreateSheet("userExport");
            IRow         row   = sheet.CreateRow(0);

            CreateHead(row);
            IList <XtmUser> list = baseDao.List(param);
            int             i    = 0;

            foreach (XtmUser temp in list)
            {
                i += 1;
                IRow rowT = sheet.CreateRow(i);
                CreateRow(rowT, temp);
            }
            return(book);
        }
Exemplo n.º 6
0
        public XSSFWorkbook Export()
        {
            XSSFWorkbook book  = new XSSFWorkbook();
            ISheet       sheet = book.CreateSheet("specExport");
            IRow         row   = sheet.CreateRow(0);

            CreateHead(row);
            YwSpec         param = new YwSpec();
            IList <YwSpec> list  = baseDao.List(param);
            int            i     = 0;

            foreach (YwSpec temp in list)
            {
                i += 1;
                IRow rowT = sheet.CreateRow(i);
                CreateRow(rowT, temp);
            }

            return(book);
        }
Exemplo n.º 7
0
        private string LoadMenuJson()
        {
            BaseDao baseDao = new BaseDao();
            XtmMenu menuM   = new XtmMenu();

            menuM.UserId = int.Parse(Request.QueryString["id"]);
            IList <XtmMenu> list = baseDao.List(menuM);

            ArrayList jsonList = new System.Collections.ArrayList();
            string    result   = "[";

            for (int i = 0; i < list.Count; i++)
            {
                XtmMenu  menuT = list[i];
                NodeData mt    = new NodeData();
                mt.id   = menuT.Did.ToString();
                mt.code = menuT.MenuCode;
                mt.pid  = menuT.ParentId.ToString();
                mt.name = menuT.MenuName;
                mt.open = true;
                if (menuT.Pri == "y")
                {
                    mt.@checked = true;
                }
                else
                {
                    mt.@checked = false;
                }
                if (i == list.Count - 1)
                {
                    result += JsonHelper.JsonSerializer <NodeData>(mt);
                }
                else
                {
                    result += JsonHelper.JsonSerializer <NodeData>(mt) + ",";
                }
            }
            result += "]";
            return(result);
        }
Exemplo n.º 8
0
 private void DealDownAtt()
 {
     YwAttach att = new YwAttach();
     att.Dataid = Entity.Did;
     att.Type = "2";
     BaseDao baseDao = new BaseDao();
     IList<YwAttach> list = baseDao.List(att);
     if (list.Count > 0)
     {
         YwAttach temp = list[0];
         string path = temp.Dic + temp.FileN;
         Response.ContentType = "application/x-zip-compressed";
         Response.AddHeader("Content-Disposition", "attachment;filename=" + temp.FileN);
         string filename = path;
         Response.TransmitFile(filename);
     }
     else
     {
         errmsg = "没有附件";
     }
     Task.Submit = false;
 }
Exemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string Cxcs = System.Configuration.ConfigurationManager.AppSettings["Cxcs"].Trim();
                WebUiProcess.InitDropDownList(this.Cxcs, Cxcs, ref errmsg);

                WebUiProcess.InitDropDownList(this.Depart, "ddlCbDepart", null, ref errmsg);
                if (Entity.Depart != null && Entity.Depart != "")
                {
                    BaseDao   baseDao = new BaseDao();
                    Hashtable ht      = new Hashtable();
                    XtmDepart de      = new XtmDepart();
                    de.DepartCode = Entity.Depart;
                    IList <XtmDepart> depL = baseDao.List(de);
                    if (depL != null && depL.Count > 0)
                    {
                        ht.Add("depart", depL[0].Did);
                        WebUiProcess.InitDropDownList(this.Ywy, "ddlCbYwy", ht, ref errmsg);
                    }
                }
            }
        }
Exemplo n.º 10
0
        private bool YwySubmit(Framework.Task.Task task, ref string errmsg)
        {
            bool result = true;

            this.BeginTran();
            try
            {
                YwData  entity  = task.Entity as YwData;
                BaseDao baseDao = new BaseDao();

                YwAttach att = new YwAttach();
                att.Type   = "1";
                att.Dataid = entity.Did;
                IList <YwAttach> attList = baseDao.List(att);
                if (attList != null && attList.Count > 0)
                {
                    entity.AttachmentCount = attList.Count;
                }
                else
                {
                    entity.AttachmentCount = 0;
                }
                entity.Status    = "3";
                entity.YwySubmit = DateTime.Now;
                if (entity.Bbr.Length <= 4)
                {
                    if (entity.Sfypz == "是")
                    {
                        YwDataService service = new YwDataService();
                        service.FirstCalculate(1, entity);
                        service.SeconeCalculate(entity);
                    }
                }
                else
                {
                    YwDataService service = new YwDataService();
                    service.FirstCalculate(1, entity);
                    service.SeconeCalculate(entity);
                }
                int count = baseDao.Update(entity);
                if (count <= 0)
                {
                    errmsg            = "数据在页面显示后被其他人修改过,请重新打开编辑";
                    task.ParentRebind = true;
                    task.Rebind       = true;
                    task.IsClose      = true;
                    return(false);
                }

                //文件压缩
                //删除压缩文件

                att.Type = "2";

                baseDao.DeleteUdf("YwAttachDeleteByType", att);
                //重新压缩附件
                if (attList != null && attList.Count > 0)
                {
                    string zipdic   = attList[0].Dic;
                    string zipFileN = Guid.NewGuid().ToString() + ".zip";
                    string path     = zipdic + zipFileN;
                    using (ZipFile zip = ZipFile.Create(@path))
                    {
                        zip.BeginUpdate();
                        foreach (YwAttach attTemp in attList)
                        {
                            string pathT = attTemp.Dic + attTemp.FileN;
                            zip.Add(@pathT, attTemp.FileN);
                        }
                        zip.CommitUpdate();
                    }
                    att.Type     = "2";
                    att.Dic      = zipdic;
                    att.FileN    = zipFileN;
                    att.RealName = zipFileN;
                    att.Dataid   = entity.Did;
                    baseDao.Insert(att);
                }
                if (result == true)
                {
                    errmsg            = "保存成功";
                    task.ParentRebind = true;
                    task.IsClose      = true;
                }
                this.CommitTran();
            }
            catch (Exception ex)
            {
                this.RollbackTran();
                errmsg = ex.Message;
            }
            return(result);
        }
Exemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                YwAttach att = new YwAttach();
                att.Dataid = Entity.Did;
                att.Type = "1";
                BaseDao baseDao = new BaseDao();
                IList<YwAttach> list = baseDao.List(att);
                if (list.Count > 0)
                {
                    string pic = System.Configuration.ConfigurationManager.AppSettings["Pic"].Trim();
                    string[] picArr = pic.Split('|');
                    int index = 0;
                    foreach (YwAttach temp in list)
                    {
                        index++;
                        string title = "<hr/><h4>附件" + index + ":" + temp.RealName + "</h4>";
                        
                        string[] arr = temp.FileN.Split('.');
                        string tailT = arr[arr.Length - 1].Trim().ToUpper();
                        string[] pathArr = temp.Dic.Split('\\');
                        string relPath = "";
                        bool enter = false;
                        for (int i = 0; i < pathArr.Length; i++)
                        {
                            if (pathArr[i] == "")
                            {
                                continue;
                            }
                            if (pathArr[i] == "upload" || enter == true)
                            {
                                relPath += pathArr[i] + "\\";
                                enter = true;
                            }
                        }
                        bool isPic = false;
                        foreach (string picT in picArr)
                        {
                            if (tailT == picT)
                            {
                                Image img = new Image();
                                img.ImageUrl = relPath + temp.FileN;
                                title += "<a href='" + relPath + temp.FileN + "'>下载</a><hr/>";
                                this.panCon.Controls.Add(new LiteralControl(title));
                                this.panCon.Controls.Add(img);
                                isPic = true;
                                break;
                            }
                        }
                        if (isPic == true)
                        {
                            continue;
                        }
                        HyperLink link = new HyperLink();
                        link.NavigateUrl = relPath + temp.FileN;

                        link.Text = temp.RealName;
                        title += "<a href='" + relPath + temp.FileN + "'>下载</a><hr/>";
                        this.panCon.Controls.Add(new LiteralControl(title));
                        this.panCon.Controls.Add(link);
                    }
                }
                else
                {
                    Label lab = new Label();
                    lab.Text = "没有附件";
                    this.panCon.Controls.Add(lab);
                }
            }
        }