public WorkHandLog SetValue(HttpRequest rp, HttpContext context)
        {
            WorkHandLog entity = new WorkHandLog();

            if (string.IsNullOrEmpty(rp["txtID"]))
            {
                entity.ID = Guid.NewGuid();
            }
            else
            {
                entity.ID           = new Guid(rp["txtID"]);
                entity.RecordStatus = StatusType.update;
            }
            if (!string.IsNullOrEmpty(context.Session["UserName"] as string))
            {
                entity.Uper   = new Guid(context.Session["UserID"].ToString());
                entity.UpName = context.Session["RealName"] as string;
            }
            entity.WorkID       = new Guid(rp["txtWorkID"]);
            entity.CurrentStaus = rp["txtHandResult"];
            entity.ChuliYj      = rp["txtChuliYj"];
            entity.HandDate     = DateTime.Now;
            entity.HandResult   = entity.CurrentStaus;
            return(entity);
        }
Exemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            NameValueCollection rp = context.Request.Form;
            Guid rwid = new Guid(rp["rwid"]);
            List <BaseEntity> list         = new List <BaseEntity>();
            string            msg          = string.Empty;
            PersonInfo        curentperson = null;
            string            zprenstr     = rp["zpren[]"];

            try
            {
                PersonInfoManager plogic = new PersonInfoManager();

                string[] zpren = zprenstr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < zpren.Length; i++)
                {
                    if (i == 0)
                    {
                        curentperson = plogic.GetItemById(new Guid(zpren[i]));
                    }
                    WorkHandLog log = new WorkHandLog();
                    log.ID           = Guid.NewGuid();
                    log.WorkID       = rwid;
                    log.CurrentStaus = "处理中";
                    log.ChuliYj      = "工作指派";
                    if (!string.IsNullOrEmpty(context.Session["UserName"] as string))
                    {
                        log.Uper   = new Guid(context.Session["UserID"].ToString());
                        log.UpName = context.Session["RealName"] as string;
                    }
                    log.DownEr       = new Guid(zpren[i]);
                    log.DownName     = plogic.GetItemById(log.DownEr.Value).RealName;
                    log.HandDate     = DateTime.Now;
                    log.HandResult   = "已指派";
                    log.HandSequence = 1;
                    list.Add(log);
                }
                WorkInfo work = new WorkInfo();
                work.ID           = rwid;
                work.RecordStatus = Sharp.Common.StatusType.update;
                work.Status       = "处理中";
                work.CurrentUser  = curentperson.RealName;
                list.Add(work);
                int result = new WorkInfoManager().Save(list);
                context.Response.Write("{\"success\":\"true\"}");
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }
            if (!string.IsNullOrEmpty(msg))
            {
                byte[] bytes  = Encoding.UTF8.GetBytes(msg.Replace("\r\n", "<br/>"));
                string encode = Convert.ToBase64String(bytes);
                context.Response.Write("{\"success\":\"false\",\"msg\":\"" + encode + "\"}");
            }
            context.Response.End();
        }
Exemplo n.º 3
0
        public WorkHandLog GetLstWorkHandInfo(string workid)
        {
            WorkHandLog tem = Dal.From <WorkHandLog>()

                              .Where(WorkHandLog._.WorkID == new Guid(workid))
                              .OrderBy(WorkHandLog._.HandSequence).ToFirst <WorkHandLog>();

            return(tem);
        }
Exemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         WorkInfoManager Manager = new WorkInfoManager();
         txtWorkID.Value = Request.QueryString["ID"];
         DataTable dt = Manager.GetWorkInfo(txtWorkID.Value);
         if (dt.Rows.Count == 1)
         {
             txtChuliYj.Value      = dt.Rows[0]["ChuLiYiJian"] as string;
             txtShebei.Value       = dt.Rows[0]["ShebeiName"] as string;
             txtGZXX.Value         = dt.Rows[0]["GuZhangXx"] as string;
             txtCurrentStaus.Value = dt.Rows[0]["Status"] as string;
             WorkHandLog last = Manager.GetLstWorkHandInfo(txtWorkID.Value);
             if (last != null)
             {
                 txtLastHandle.Value = last.ChuliYj;
             }
         }
     }
 }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            HttpRequest rp  = context.Request;
            string      msg = string.Empty;

            try
            {
                WorkInfoManager   manager    = new WorkInfoManager();
                List <BaseEntity> entityList = new List <BaseEntity>();
                int      maxsequenc          = manager.GetMaxSequence(new Guid(rp["txtWorkID"]));
                string   zt   = rp["txtHandResult"];
                WorkInfo work = new WorkInfo();
                work.ID           = new Guid(rp["txtWorkID"]);
                work              = manager.GetItemById(work.ID);
                work.RecordStatus = StatusType.update;
                work.Status       = zt;
                ShebeiInfo s = new ShebeiInfo();
                s = new ShebeiInfoManager().GetItemById(work.SbID);

                if (zt == "处理中")
                {
                    string[] zprid   = rp["txtZprID"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    string[] zprName = rp["txtZprName"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    work.CurrentUser = rp["txtZprName"];
                    for (int i = 0; i < zprid.Length; i++)
                    {
                        WorkHandLog tem = SetValue(rp, context);
                        tem.DownEr       = new Guid(zprid[i]);
                        tem.DownName     = zprName[i];
                        tem.HandSequence = maxsequenc;

                        entityList.Add(tem);
                    }
                    s.State = zt;
                }
                else
                {
                    work.RealTime    = DateTime.Now;
                    work.CurrentUser = manager.GetLastUserName(work.ID);
                    WorkHandLog tem = SetValue(rp, context);
                    tem.HandSequence = maxsequenc;
                    int handType = 0;
                    int.TryParse(rp["txtHandType"], out handType);
                    tem.HandType = handType;
                    entityList.Add(tem);
                    s.State = "正常";

                    if (rp["txtHandType"] == "0")
                    {
                        //维修

                        string sql = "update ShebeiInfo set GZTJ=isnull(GZTJ,0)+1 where id='" + s.ID + "'";
                        Sharp.Data.SessionFactory.Default.FromCustomSql(sql).ExecuteNonQuery();
                    }
                    else if (rp["txtHandType"] == "1")
                    {
                        //更换
                        string sql = "update ShebeiInfo set GHTJ=isnull(GHTJ,0)+1 where id='" + s.ID + "'";
                        Sharp.Data.SessionFactory.Default.FromCustomSql(sql).ExecuteNonQuery();
                    }
                }

                entityList.Add(work);
                entityList.Add(s);
                manager.Save(entityList);
                context.Response.Write("{\"success\":\"true\"}");
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }
            if (!string.IsNullOrEmpty(msg))
            {
                byte[] bytes  = Encoding.UTF8.GetBytes(msg.Replace("\r\n", "<br/>"));
                string encode = Convert.ToBase64String(bytes);
                context.Response.Write("{\"success\":\"false\",\"msg\":\"" + encode + "\"}");
            }
            context.Response.End();
        }