Ejemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.Log DataRowToModel(DataRow row)
 {
     Model.Log model=new Model.Log();
     if (row != null)
     {
         if(row["AutoID"]!=null && row["AutoID"].ToString()!="")
         {
             model.AutoID=long.Parse(row["AutoID"].ToString());
         }
         if(row["OperationItem"]!=null)
         {
             model.OperationItem=row["OperationItem"].ToString();
         }
         if(row["OperationTime"]!=null && row["OperationTime"].ToString()!="")
         {
             model.OperationTime=DateTime.Parse(row["OperationTime"].ToString());
         }
         if(row["OperationDetail"]!=null)
         {
             model.OperationDetail=row["OperationDetail"].ToString();
         }
         if(row["Operator"]!=null)
         {
             model.Operator=row["Operator"].ToString();
         }
         if(row["Memo"]!=null)
         {
             model.Memo=row["Memo"].ToString();
         }
     }
     return model;
 }
Ejemplo n.º 2
0
 protected void Bt_Login_Click(object sender, EventArgs e)
 {
     string loginId = TB_LoginId.Text.Trim();
     string password = TB_Password.Text.Trim();
     if (CB_Storage.Checked)
         StoragePwd(loginId, password);
     SessionUser user = new SessionUser();
     user.SetSession(loginId, password, Session);
     if (SessionUser.IsLogined())
     {
         Model.Log logM = new Model.Log();
         logM.OperationItem = "操作员登录";
         logM.Operator = loginId;
         logM.OperationTime = DateTime.Now;
         logM.OperationDetail = "ip:【" + Request.UserHostAddress + "】";
         _log.Add(logM);
         if (Request.QueryString["returnurl"] == null)
             Response.Redirect("NewsManage/NewsList.aspx");
         else
             Response.Redirect(HttpUtility.UrlDecode(Request.QueryString["returnurl"].ToString()));
     }
     else
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('用户名不存在或密码错误!');", true);
     }
 }
Ejemplo n.º 3
0
        protected void BtnOk_Click(object sender, EventArgs e)
        {
            id = RequestInt32("orderid");
            if (id <= 0)
            {
                WriteMessage("无法获取有效信息", false);
            }

            t = OrderBll.GetOrder(id, true);
            if (t == null)
            {
                WriteMessage("无法获取有效信息", false);
            }

            t.Status = Model.OrderStatus.Running;
            t.PublishUserName = tbPublishUserName.Text;
            t.QualityUserName = tbQualityUserName.Text;
            t.Task.Status = Model.TaskState.Ordering;

            Model.Log l = new Model.Log();
            l.Task = t.Task;
            l.Title = "任务(编码:"+t.Task.Code+")订单记录";
            l.Type = Model.LogType.Main;
            l.StartUserName = RequestContext.Current.User.UserName;
            l.AddTime = DateTime.Now;
            l.RangeBegin = DateTime.Now;
            l.Description = tbDescription.Text;
            l.Action = Model.LogAction.Order;
            t.Task.Logs.Add(l);

            bool flag = TaskBll.UpdateTask(t.Task, new string[] { "Status" });

            WriteMessage(flag ? "操作成功" : "操作失败", flag);
        }
Ejemplo n.º 4
0
        protected void btnResult_Click(object sender, EventArgs e)
        {
            Model.Log log = task.Logs.OrderByDescending(m => m.Id).FirstOrDefault(m => m.Action == Model.LogAction.Order && !m.RangeEnd.HasValue);
            if (log == null)
            {
                WriteMessage("当前无可用数据", false);
            }

            log.RangeEnd = DateTime.Now;
            log.EndUserName = RequestContext.Current.User.UserName;
            task.Status = Model.TaskState.Stocking;

            order.Status = Model.OrderStatus.End;

            Model.Log stocklog = new Model.Log();
            stocklog.Action = Model.LogAction.Stock;
            stocklog.AddTime = DateTime.Now;
            stocklog.RangeBegin = DateTime.Now;
            stocklog.StartUserName = RequestContext.Current.User.UserName;
            stocklog.Title = "任务(编码:" + task.Code + ")入库记录";
            stocklog.Type = Model.LogType.Main;
            task.Logs.Add(stocklog);

            bool flag = TaskBll.UpdateTask(task, new string[] { "Status" });

            WriteMessage(flag ? "订单已完成,等待入库" : "更新操作失败,请重试", flag);
        }
Ejemplo n.º 5
0
 protected void RGrid_SubSysCode_ItemCommand(object sender, GridCommandEventArgs e)
 {
     if (e.CommandName == "Del")
     {
         string subSysCodeId = Convert.ToString(e.CommandArgument);
         bool isDelete = false;
         Model.Log logModel = new Model.Log();
         logModel.OperationItem = "删除子类";
         logModel.Operator = user.UserInfo.UserID;
         logModel.OperationTime = DateTime.Now;
         try
         {
             Model.SysCodeDetail scdModel = new Model.SysCodeDetail();
             logModel.OperationDetail = "子类编号:" + scdModel.SYSCodeDetialID + " - 子类内容:" + scdModel.SYSCodeDetialContext;
             isDelete = scd.Delete(subSysCodeId);
             if (isDelete)
             {
                 logModel.Memo = "成功";
             }
             else
             {
                 logModel.Memo = "失败!";
             }
         }
         catch (Exception ex)
         {
             logModel.Memo = "异常:" + ex.Message;
         }
         finally
         {
             log.Add(logModel);
             if (isDelete)
             {
                 int delNo = -1;
                 List<Model.SysCodeDetail> sysCodeDetailList = (List<Model.SysCodeDetail>)ViewState["SubSysCodeList"];
                 for(int i =0;i<sysCodeDetailList.Count;i++)
                 {
                     string tstr = sysCodeDetailList[i].SYSCodeDetialID;
                     if (tstr.Equals(subSysCodeId))
                     {
                         delNo = i;
                         break;
                     }
                 }
                 if (delNo != -1)
                 {
                     sysCodeDetailList.RemoveAt(delNo);
                 }
                 RGrid_SubSysCode.DataSource = sysCodeDetailList;
                 RGrid_SubSysCode.DataBind();
                 RadScriptManager.RegisterStartupScript(Page, GetType(), "c1", "OpenAlert('恭喜!删除成功!');", true);
             }
             else
             {
                 RadScriptManager.RegisterStartupScript(Page, GetType(), "c2", "OpenAlert('抱歉!删除失败!<br />请检查该小类是否存在未移除的关联!');", true);
             }
         }
     }
 }
Ejemplo n.º 6
0
 protected void RGrid_SysCode_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
 {
     if (e.CommandName == "Del")
     {
         string sysCodeId = Convert.ToString(e.CommandArgument);
         bool result = false;
         Model.Log logModel = new Model.Log();
         logModel.OperationItem = "删除系统代码";
         logModel.Operator = user.UserInfo.UserID;
         logModel.OperationTime = DateTime.Now;
         try
         {
             Model.SysCode scModel = sc.GetModel(sysCodeId);
             logModel.OperationDetail = "代码编号:" + scModel.SYSCodeID + " - 代码内容:" + scModel.SYSCodeContext;
             result = sc.Delete(sysCodeId);
             if (result)
             {
                 logModel.Memo = "成功";
             }
             else
             {
                 logModel.Memo = "失败!";
             }
         }
         catch (Exception ex)
         {
             logModel.Memo = "异常: " + ex.Message;
         }
         finally
         {
             log.Add(logModel);
             if (result)
             {
                 int delNo = -1;
                 DataTable sysCodeList = (DataTable)ViewState["SysCodeList"];
                 for (int i = sysCodeList.Rows.Count - 1; i >= 0; i--)
                 {
                     if (sysCodeList.Rows[i][0].ToString().Equals(sysCodeId))
                     {
                         delNo = i;
                         break;
                     }
                 }
                 if (delNo != -1)
                 {
                     sysCodeList.Rows.RemoveAt(delNo);
                 }
                 RGrid_SysCode.DataSource = sysCodeList;
                 RGrid_SysCode.DataBind();
                 RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('恭喜!代码删除成功。');", true);
             }
             else
             {
                 RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c2", "OpenAlert('抱歉!代码删除失败。<br />请检查该大类是否存在小类未删除!');", true);
             }
         }
     }
 }
Ejemplo n.º 7
0
 protected void Bt_Modify_Click(object sender, EventArgs e)
 {
     string SubCodeName = subSysCodeId;
     string SubCodeContent = TB_SubCodeContent.Text.Trim();
     bool SubCodeEnable = RCB_Enable.SelectedItem.Value == "1" ? true : false;
     string SubCodeMemo = TB_SubCodeMemo.Text.Trim();
     if (SubCodeContent == "")
     {
         RadScriptManager.RegisterStartupScript(Page, GetType(), "c1", "OpenAlert('代码内容必须为1-50个字符!');", true);
         return;
     }
     Model.Log logModel = new Model.Log();
     logModel.OperationItem = "修改小类信息";
     logModel.Operator = user.UserInfo.UserID;
     logModel.OperationTime = DateTime.Now;
     BLL.SysCodeDetail scd = new BLL.SysCodeDetail();
     Model.SysCodeDetail scdModel = scd.GetModel(SubCodeName);
     scdModel.SYSCodeDetialID = SubCodeName;
     scdModel.SYSCodeDetialContext = SubCodeContent;
     scdModel.LastModifyTime = DateTime.Now;
     scdModel.Memo = SubCodeMemo;
     scdModel.IsValid = SubCodeEnable;
     bool isUpdate = false;
     logModel.OperationDetail = "小类编号:"+SubCodeName + " - 父类编号:" +scdModel.SYSCodeID+ " - 小类名称:"+SubCodeContent + " - 状态:"+SubCodeEnable;
     try
     {
         isUpdate = scd.Update(scdModel);
         if (isUpdate)
         {
             logModel.Memo = "成功";
         }
         else
         {
             logModel.Memo = "失败!";
         }
     }
     catch (Exception ex)
     {
         logModel.Memo = "异常:" + ex.Message;
     }
     finally
     {
         log.Add(logModel);
         if (isUpdate)
         {
             RadScriptManager.RegisterStartupScript(Page, GetType(), "c2", "OpenAlert('恭喜!小类\"" + SubCodeName + "\"修改成功!');", true);
         }
         else
         {
             RadScriptManager.RegisterStartupScript(Page, GetType(), "c3", "OpenAlert('抱歉!小类\"" + SubCodeName + "\"修改失败!');", true);
         }
     }
 }
Ejemplo n.º 8
0
 protected void Bt_Modify_Click(object sender, EventArgs e)
 {
     string CodeName = sysCodeId;
     string CodeContent = TB_CodeContent.Text.Trim();
     bool CodeEnable = RCB_Enable.SelectedItem.Value == "1";
     string CodeMemo = TB_CodeMemo.Text.Trim();
     if (CodeName == "")
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('代码内容必须为1-50个字符!');", true);
         return;
     }
     Model.SysCode scModel = new Model.SysCode();
     scModel.SYSCodeID = CodeName;
     scModel.SYSCodeContext = CodeContent;
     scModel.ISValid = CodeEnable;
     scModel.Memo = CodeMemo;
     scModel.LastModifytime = DateTime.Now;
     bool isUpdate = false;
     Model.Log logModel = new Model.Log();
     logModel.OperationItem = "修改大类信息";
     logModel.Operator = user.UserInfo.UserID;
     logModel.OperationTime = DateTime.Now;
     logModel.OperationDetail = "大类编号:"+CodeName + " - 大类名称:" +CodeContent+ " - 状态:" +CodeEnable;
     try
     {
         isUpdate = sc.Update(scModel);
         if (isUpdate)
         {
             logModel.Memo = "成功";
         }
         else
         {
             logModel.Memo = "失败!";
         }
     }
     catch (Exception ex)
     {
         logModel.Memo = "异常:" + ex.Message;
     }
     finally
     {
         log.Add(logModel);
         if (isUpdate)
         {
             RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c2", "OpenAlert('恭喜!修改成功!');", true);
         }
         else
         {
             RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c3", "OpenAlert('抱歉!修改失败!');", true);
         }
     }
 }
 protected void LB_Logout_Click(object sender, EventArgs e)
 {
     Model.Log logM = new Model.Log();
     logM.OperationItem = "操作员注销";
     logM.Operator = LoginId;
     logM.OperationTime = DateTime.Now;
     logM.OperationDetail = "ip:【" + Request.UserHostAddress + "】";
     log.Add(logM);
     Session.Abandon();
     ClearPwdCookie();
     string loginUrl = WebConfigurationManager.AppSettings["LoginPageUrl"].Trim();
     Response.Redirect(loginUrl);
 }
Ejemplo n.º 10
0
 protected void Bt_Submit_Click(object sender, EventArgs e)
 {
     string categryName = TB_CategoryName.Text;
     if (categryName == "")
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c2", "OpenAlert('抱歉!添加失败!分类名称必须为1-50个字符!');", true);
         return;
     }
     SmartLaw.Model.Category cgModel = new Model.Category();
     cgModel.ParentCategoryID = cpautoID;
     cgModel.CategoryName = categryName;
     cgModel.IsValid = RCB_Enable.SelectedItem.Value == "1" ? true : false;
     cgModel.LastModifyTime = DateTime.Now;
     cgModel.Memo = TB_Memo.Text;
     long newAutoID = 0;
     Model.Log logModel = new Model.Log();
     logModel.OperationItem = "添加分类";
     logModel.Operator = user.UserInfo.UserID;
     logModel.OperationTime = DateTime.Now;
     logModel.OperationDetail = "分类名称:" + categryName + " - 父类编号:" + cpautoID + " - 分类备注:" + TB_Memo.Text;
     try
     {
         cgModel.Orders = cg.GetList(2, cpautoID.ToString()).Tables[0].Rows.Count + 1;
         newAutoID = cg.Add(cgModel);
         if (newAutoID != 0)
         {
             logModel.Memo = "成功";
         }
         else
         {
             logModel.Memo = "失败!";
         }
     }
     catch (Exception ex)
     {
         logModel.Memo = "异常:" + ex.Message;
     }
     finally
     {
         log.Add(logModel);
         if (newAutoID != 0)
         {
             RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c4", "OpenAlert('添加子类成功!');", true);
         }
         else
         {
             RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c5", "OpenAlert('添加子类失败!');", true);
         }
     }
 }
Ejemplo n.º 11
0
        protected void Bt_Modify_Click(object sender, EventArgs e)
        {
            string categryName = TB_CategoryName.Text;
            if (categryName == "")
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c2", "OpenAlert('抱歉!修改失败!分类名称容必须为1-50个字符!');", true);
                return;
            }
            Model.Category cgModel = cg.GetModel(autoID);
            cgModel.CategoryName = categryName;
            cgModel.IsValid = RCB_Enable.SelectedItem.Value == "1" ? true : false;
            cgModel.LastModifyTime = DateTime.Now;
            cgModel.Memo = TB_Memo.Text;
            bool isUpdate = false;
            Model.Log logModel = new Model.Log();
            logModel.OperationItem = "修改分类信息";
            logModel.Operator = user.UserInfo.UserID;
            logModel.OperationTime = DateTime.Now;
            logModel.OperationDetail = "分类编号:" + cgModel.AutoID + " - 分类名称:" + cgModel.CategoryName + " - 父类编号:" + cgModel.ParentCategoryID + "状态:" + cgModel.IsValid;

            try
            {
                isUpdate = cg.Update(cgModel);
                if (isUpdate)
                {
                    logModel.Memo = "成功";
                }
                else
                {
                    logModel.Memo = "失败!";
                }
            }
            catch (Exception ex)
            {
                logModel.Memo = "异常:" + ex.Message;
            }
            finally
            {
                log.Add(logModel);
                if (isUpdate)
                {
                    ReadValue();
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c4", "OpenAlert('恭喜,修改分类信息成功!');", true);
                }
                else
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c5", "OpenAlert('抱歉,修改分类信息失败!');", true);
            }
        }
Ejemplo n.º 12
0
        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName=="Result")
            {
                Model.Order order = OrderBll.GetOrder(Util.DataConverter.ToLng(e.CommandArgument),true);
                if (order==null)
                {
                    WriteMessage("当前无可用数据", false);
                }
                Model.Task task = order.Task;
                Model.Log log = task.Logs.OrderByDescending(m => m.Id).FirstOrDefault(m => m.Action == Model.LogAction.Order && !m.RangeEnd.HasValue);
                if (log == null)
                {
                    WriteMessage("当前无可用数据", false);
                }

                log.RangeEnd = DateTime.Now;
                log.EndUserName = RequestContext.Current.User.UserName;
                task.Status = Model.TaskState.Stocking;

                order.Status = Model.OrderStatus.End;

                Model.Log stocklog = new Model.Log();
                stocklog.Action = Model.LogAction.Stock;
                stocklog.AddTime = DateTime.Now;
                stocklog.RangeBegin = DateTime.Now;
                stocklog.StartUserName = RequestContext.Current.User.UserName;
                stocklog.Title = "任务(编码:" + task.Code + ")入库记录";
                stocklog.Type = Model.LogType.Main;
                task.Logs.Add(stocklog);

                bool flag = TaskBll.UpdateTask(task, new string[] { "Status" });
                if (flag)
                {
                    BindData();
                }
                else
                {
                    WriteMessage("更新操作失败,请重试", flag);
                }

            }
        }
Ejemplo n.º 13
0
        protected void BtnOk_Click(object sender, EventArgs e)
        {
            //t.Code = tbCode.Text;
            t.DevelopUserName = tbDevelopUserName.Text;
            t.Status = Model.TaskState.DevelopConfirmed;
            Model.Log l = new Model.Log();
            l.Task = t;
            l.Title = "研发任务确认";
            l.Type = Model.LogType.Normal;
            l.StartUserName = RequestContext.Current.User.UserName;
            l.AddTime = DateTime.Now;
            l.Description = tbDescription.Text;
            l.Action = Model.LogAction.DevelopConfirm;
            t.Logs.Add(l);

            bool flag = TaskBll.UpdateTask(t, new string[] { "Code", "DevelopUserName","Status" });

            WriteMessage(flag ? "操作成功" : "操作失败", flag);
        }
Ejemplo n.º 14
0
 protected void btn_ChangeValid_Click(object sender, EventArgs e)
 {
     bool qnEnable = RCB_Enable.SelectedItem.Value == "1" ? true : false;
     Model.Questionary qnMOdel = qn.GetQnModel(QnID);
     qnMOdel.IsValid = qnEnable;
     bool isUpdate = false;
     Model.Log logModel = new Model.Log();
     try
     {
         logModel.OperationItem = "修改问卷状态";
         logModel.Operator = user.UserInfo.UserID;
         logModel.OperationTime = DateTime.Now;
         logModel.OperationDetail = "问卷编号:" + QnID + " - 状态:" + qnEnable;
         isUpdate = qn.UpdateQuestionary(qnMOdel);
         if (isUpdate)
         {
             logModel.Memo = "成功";
         }
         else
         {
             logModel.Memo = "失败!";
         }
     }
     catch (Exception ex)
     {
         logModel.Memo += "异常:" + ex.Message;
     }
     finally
     {
         log.Add(logModel);
         if (isUpdate)
         {
             RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c2", "OpenAlert('恭喜!状态修改成功!');", true);
         }
         else
         {
             RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c3", "OpenAlert('抱歉!状态修改失败!');", true);
         }
     }
 }
Ejemplo n.º 15
0
 protected void Bt_Modify_Click(object sender, EventArgs e)
 {
     Model.Integral igM = ig.GetModelList(1, SimID, 1, 5, true)[0];
     Model.Log logM = new Model.Log();
     logM.OperationItem = "修改积分";
     logM.OperationDetail = "Sim:"+SimID+";原积分:"+igM.TotalIntegral+";当前积分:"+TB_TotalIntegral.Text;
     logM.OperationTime = DateTime.Now;
     logM.Operator = _user.UserInfo.UserID;
     logM.Memo = "";
     int added = int.Parse((long.Parse(TB_TotalIntegral.Text) - igM.TotalIntegral).ToString());
     bool isSet = false;
     try
     {
         Model.Integral newIgm = new Model.Integral();
         newIgm.IntegralAdded = added;
         newIgm.Items = "手动设置-"+_user.UserInfo.UserName+"["+_user.UserInfo.UserID+"]";
         newIgm.LastModifyTime = DateTime.Now;
         newIgm.SimCardNo = SimID;
         newIgm.TotalIntegral = long.Parse(TB_TotalIntegral.Text);
         isSet = ig.Add(newIgm);
     }
     catch (Exception ex)
     {
         logM.Memo += ex.Message;
     }
     finally
     {
         log.Add(logM);
         if (isSet)
         {
             ReadValue();
             RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c4", "OpenAlert('恭喜,积分手动设置成功!');", true);
         }
         else
             RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c5", "OpenAlert('抱歉,积分手动设置失败!');", true);
     }
 }
Ejemplo n.º 16
0
        public static void WriteLog(HttpRequest request)
        {
            if (Libs.LibSession.Get(Libs.Constants.ACCOUNT_LOGIN) != null)
            {
                Repository.Application applicationRepository = new Repository.Application();
                Repository.User userRepository = new Repository.User();
                string applicationPath = request.Path.Substring(1, request.Path.Length - 1);
                var app = applicationRepository.GetApplicationByFilePath(applicationPath);
                int userID = userRepository.GetUserIDByUsername(Libs.LibSession.Get(Libs.Constants.ACCOUNT_LOGIN).ToString());
                Model.Log log = new Model.Log();
                log.UserID = userID;
                log.Trace = applicationPath;
                log.Date = DateTime.Now;
                if (app != null)
                {
                    log.Action = app.Application_Description;
                }
                if (request.ServerVariables["REMOTE_ADDR"] != null)
                {
                    log.IP = request.ServerVariables["REMOTE_ADDR"].ToString();
                }
                log.Time_Login = DateTime.Now;

                if (Libs.LibSession.Get(Libs.Constants.LOG) != null)
                {
                    var list = (List<Model.Log>)Libs.LibSession.Get(Libs.Constants.LOG);
                    list.Add(log);
                    Libs.LibSession.Set(Libs.Constants.LOG, list);
                }
                else
                {
                    List<Model.Log> LogList = new List<Model.Log>();
                    LogList.Add(log);
                    Libs.LibSession.Set(Libs.Constants.LOG, LogList);
                }
            }
        }
Ejemplo n.º 17
0
        private bool PdfToImage(string pdfName, string fileCurrentName)
        {
            int desired_x_dpi = 300;
            int desired_y_dpi = 300;

            string ServerPath = Server.MapPath(".\\");
            string pdfPath    = Server.MapPath(".\\") + "PO_PdfRequest/" + fileCurrentName + ".pdf";



            string pageCount;

            BLL.PO _BLL = new BLL.PO();
            pageCount = _BLL.Get_PageCount(Session["DOC_ID"].ToString());



            //for (int i = 0; i < int.Parse(pageCount); i++)
            //{



            //    if (int.Parse(pageCount) > 1)
            //    {
            //        zoomImg.Save(@ServerPath + "/PdfToImageApprove/" + fileCurrentName + "_" + (i + 1) + ".PNG");

            //    }
            //    else
            //    {
            //        zoomImg.Save(@ServerPath + "/PdfToImageApprove/" + fileCurrentName + ".PNG");

            //    }
            //}


            using (var rasterizer = new GhostscriptRasterizer())
            {
                rasterizer.Open(pdfPath);

                for (var pageNumber = 1; pageNumber <= int.Parse(pageCount); pageNumber++)
                {
                    if (int.Parse(pageCount) > 1)
                    {
                        var pageFilePath = Path.Combine(Server.MapPath("~/PO_PdfToImageRequest/"), fileCurrentName + "_" + (pageNumber) + ".PNG");
                        var img          = rasterizer.GetPage(desired_x_dpi, desired_y_dpi, pageNumber);
                        img.Save(pageFilePath);
                    }
                    else
                    {
                        var pageFilePath = Path.Combine(Server.MapPath("~/PO_PdfToImageRequest/"), fileCurrentName + ".PNG");
                        var img          = rasterizer.GetPage(desired_x_dpi, desired_y_dpi, pageNumber);
                        img.Save(pageFilePath);
                    }
                }
            }

            //Model.Criteria.Document doc = new Model.Criteria.Document();
            //doc.doc_id = fileCurrentName;
            //doc.upload_date = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");

            //BLL.Upload _BLL = new BLL.Upload();
            //int ret;
            //ret = _BLL.Update_upload_date(doc);


            // Write LOG

            Model.Log      L   = new Model.Log();
            Helper.Utility Log = new Helper.Utility();

            L.content   = "Convert PO PDF to Image success.";
            L.create_by = Session["EMAIL"].ToString();

            Log.WriteLog(L);

            return(true);
        }
Ejemplo n.º 18
0
        void testPostback()
        {
            if (txtNot.Text != "")
            {
                Model.PO_Document _doc = new Model.PO_Document();
                _doc.doc_id          = doc_id.Value;
                _doc.approve_problem = txtNot.Text;
                BLL.PO _BLL = new BLL.PO();
                _BLL.Update_sign_approve_problem(_doc);


                //   Response.Redirect("./DataDocument.aspx");
            }
            else
            {
                Model.PO_Document _doc = new Model.PO_Document();
                _doc.doc_id          = doc_id.Value;
                _doc.approve_problem = "0";
                BLL.PO _BLL = new BLL.PO();
                _BLL.Update_sign_approve_problem(_doc);
            }

            string currentFile = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "/tmpFrmApplication.html";
            var    url         = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "/PO_FrmApplicationApprove.aspx?doc_id=" + doc_id.Value + "&signature=" + signature_file.Value + "&page_count=" + page_count.Value + "&paper_type=" + paper_type.Value + "&top=" + dTop.Value + "&left=" + dLeft.Value;
            var    http        = (HttpWebRequest)WebRequest.Create(url);
            var    response    = http.GetResponse();

            var    stream  = response.GetResponseStream();
            var    sr      = new StreamReader(stream);
            string content = sr.ReadToEnd();

            Int32  pos_start, pos_stop;
            string MidString;

            pos_start = content.IndexOf("submit", 0);
            pos_stop  = content.IndexOf("/>", pos_start);
            MidString = content.Substring(pos_start - 13, (pos_stop + 2) - (pos_start - 13));
            content   = content.Replace(MidString, "");

            pos_start = content.IndexOf("txtNot", 0);
            pos_stop  = content.IndexOf("/>", pos_start);
            MidString = content.Substring(pos_start - 13, (pos_stop + 2) - (pos_start - 13));
            content   = content.Replace(MidString, "");


            content = content.Replace("top:5000px", "top:" + dTop.Value.Replace("'", ""));
            content = content.Replace("left:5000px", "left:" + dLeft.Value.Replace("'", ""));
            if (txtNot.Text == "")
            {
                content = content.Replace("hidden='hidden'", "");
            }
            string path = System.AppDomain.CurrentDomain.BaseDirectory + "tmpFrmApplication.html";

            System.IO.File.WriteAllText(path, content);


            //   string currentFile = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "/tmpFormApplication.html";
            DateTime time   = DateTime.Now;
            string   format = "M-d-h-mm-ss";
            string   tmp    = time.ToString(format);



            if (HtmlToPdf(currentFile, doc_id.Value, paper_type.Value))
            {
                Model.Log      L   = new Model.Log();
                Helper.Utility Log = new Helper.Utility();

                L.content   = "Sign PO approve success.";
                L.create_by = Session["EMAIL"].ToString();
                Log.WriteLog(L);

                Model.PO_Document _Doc = new Model.PO_Document();
                BLL.PO            _BLL = new BLL.PO();

                _Doc.sign_approve_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                _Doc.doc_id            = doc_id.Value;
                _BLL.Update_sign_approve_date(_Doc);


                /////////////////////////   ReplyMail();


                Response.Redirect("./PO_DataDocument.aspx");
            }
            else
            {
                //   Response.Redirect("./Pdf/" + tmp + ".Pdf");
            }
        }
Ejemplo n.º 19
0
        //同步
        protected void Button1_Click(object sender, EventArgs e)
        {
            int selectCount = RGrid_EndUserList.SelectedItems.Count;
            if (selectCount == 0)
            {
                RadScriptManager.RegisterStartupScript(Page, GetType(), "c3", "OpenAlert('抱歉!您未选择任何项!!');", true);
                return;
            }
            Model.Log logModel = new Model.Log();
            logModel.OperationItem = "批量同步终端用户";
            logModel.Operator = user.UserInfo.UserID;
            logModel.OperationTime = DateTime.Now;
            int totCount = selectCount;
            StringBuilder notExist = new StringBuilder("");
            bool isSyncMgUp = false;
            bool isSyncMgIn = false;
            try
            {
                StringBuilder sb = new StringBuilder("【");
                StringBuilder sbU = new StringBuilder("【");
                StringBuilder sbI = new StringBuilder("【");
                List<MongoDBService.EndUser> euUpList = new List<MongoDBService.EndUser>();
                List<MongoDBService.EndUser> euInList = new List<MongoDBService.EndUser>();
                using (MongoDBServiceSoapClient mg = new MongoDBServiceSoapClient())
                {
                    foreach (GridDataItem item in RGrid_EndUserList.MasterTableView.Items)
                    {
                        if ((item["CheckboxSelectColumn"].Controls[0] as CheckBox).Checked)
                        {
                            String autoid = item["AutoID"].Text;
                            sb.Append(autoid + " ");
                            if (!eu.Exists(long.Parse(autoid)))
                            {
                                continue;
                            }
                            Model.EndUser euModel = eu.GetModel(long.Parse(autoid));
                            MongoDBService.EndUser dc = new MongoDBService.EndUser();
                            dc.AutoID = euModel.AutoID.ToString();
                            dc.EnduserName = euModel.EndUserName;
                            string[] identityArr = euModel.Identities.Split('|');
                            ArrayOfString aof = new ArrayOfString();
                            foreach (string id in identityArr)
                            {
                                if (id.Equals(""))
                                {
                                    continue;
                                }
                                aof.Add(id);
                            }
                            dc.Identities = aof;
                            dc.IsValid = euModel.IsValid;
                            dc.LastModifyTime = euModel.LastModifyTime;
                            dc.SimCardNo = euModel.SimCardNo;
                            string rtStrx = "";
                            if (mg.SelectEnduserBySimCardNo(euModel.SimCardNo, out rtStrx) != null)
                            {
                                sbU.Append(autoid + " ");
                                euUpList.Add(dc);
                            }
                            else
                            {
                                sbI.Append(autoid + " ");
                                euInList.Add(dc);
                            }
                        }
                    }

                    string info0 = "";
                    string info1 = "";
                    isSyncMgUp = true;
                    if (euUpList.Count > 0)
                    {
                        string rtStr = "";
                        isSyncMgUp = false;
                        isSyncMgUp = mg.UpdateEndusers(euUpList.ToArray(), out rtStr);
                        if (isSyncMgUp)
                        {
                            info0 = "同步成功(更新)列表[" + euUpList.Count + "]:" + sbU.ToString();
                        }
                        else
                        {
                            info0 = "同步成功(更新)列表[" + euUpList.Count + "]:无";
                        }
                        logModel.Memo += "同步更新返回:" + rtStr;
                    }
                    isSyncMgIn = true;
                    if (euInList.Count > 0)
                    {
                        string rtStr = "";
                        isSyncMgIn = false;
                        isSyncMgIn = mg.InsertEndusers(euInList.ToArray(), out rtStr);
                        if (isSyncMgIn)
                        {
                            info0 = "同步成功(新增)列表[" + euUpList.Count + "]:" + sbU.ToString();
                        }
                        else
                        {
                            info0 = "同步成功(新增)列表[" + euUpList.Count + "]:无";
                        }
                        logModel.Memo += "同步新增返回:" + rtStr; ;
                    }
                    sb.Append("】");
                    sbU.Append("】");
                    sbI.Append("】");
                    logModel.OperationDetail = "同步请求列表[" + totCount + "]:" + sb.ToString() + info0 + info1;
                }
            }
            catch (Exception ex)
            {
                logModel.Memo = "异常:" + ex.Message;
            }
            finally
            {
                if (isSyncMgUp && isSyncMgIn)
                {
                    logModel.Memo = "成功";
                    log.Add(logModel);
                    RadScriptManager.RegisterStartupScript(Page, GetType(), "c2", "OpenAlert('恭喜!同步成功!');", true);
                }
                else
                {
                    logModel.Memo += "失败";
                    log.Add(logModel);
                    RadScriptManager.RegisterStartupScript(Page, GetType(), "c3", "OpenAlert('抱歉!同步未完全成功!');", true);
                }
            }
        }
Ejemplo n.º 20
0
        protected void RGrid_EndUserList_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "Del")
            {
                string AutoID = Convert.ToString(e.CommandArgument);
                bool isDelete = false;
                Model.Log logModel = new Model.Log();
                logModel.OperationItem = "删除终端用户";
                logModel.Operator = user.UserInfo.UserID;
                logModel.OperationTime = DateTime.Now;
                Model.EndUser euModel = eu.GetModel(long.Parse(AutoID));
                try
                {
                    if (euModel != null)
                    {
                        logModel.OperationDetail = "用户姓名:" + euModel.EndUserName + " - STB号:" + euModel.SimCardNo + " - 身份:" + euModel.Identities;

                        using (MongoDBServiceSoapClient mg = new MongoDBServiceSoapClient())
                        {
                            string rtStr = "";
                            bool isDeleteMg = true;
                            if (mg.SelectEnduserBySimCardNo(euModel.SimCardNo, out rtStr) != null)
                            {
                                isDeleteMg = false;
                                isDeleteMg = mg.DeleteEnduser(euModel.SimCardNo, out rtStr);
                            }
                            if (isDeleteMg)
                            {
                                isDelete = eu.Delete(long.Parse(AutoID));
                            }

                            logModel.Memo += rtStr;
                        }
                    }
                }
                catch (Exception ex)
                {
                    logModel.Memo = "异常:" + ex.Message;
                }
                finally
                {
                    if (euModel != null)
                    {
                        log.Add(logModel);
                        if (isDelete)
                        {
                            List<Model.EndUser> endUserList = (List<Model.EndUser>)ViewState["EndUserList"];
                            endUserList.RemoveAll(rt => rt.AutoID == long.Parse(AutoID));
                            RGrid_EndUserList.DataSource = endUserList;
                            RGrid_EndUserList.Rebind();
                            RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cc1", "OpenAlert('恭喜用户删除成功。');", true);
                        }
                        else
                        {
                            RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cc2", "OpenAlert('抱歉!用户删除失败。');", true);
                        }
                    }
                    else
                    {
                        List<Model.EndUser> endUserList = (List<Model.EndUser>)ViewState["EndUserList"];
                        endUserList.RemoveAll(rt => rt.AutoID == long.Parse(AutoID));
                        RGrid_EndUserList.DataSource = endUserList;
                        RGrid_EndUserList.DataBind();
                        ViewState["EndUserList"] = endUserList;
                        RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cc2", "OpenAlert('抱歉!用户删除失败。该用户已不存在!!');", true);
                    }
                }
            }
            if (e.CommandName == "Sync")
            {
                string AutoID = Convert.ToString(e.CommandArgument);
                bool isSyncMg = false;
                Model.Log logModel = new Model.Log();
                logModel.OperationItem = "同步终端用户";
                logModel.Operator = user.UserInfo.UserID;
                logModel.OperationTime = DateTime.Now;
                Model.EndUser euModel = eu.GetModel(long.Parse(AutoID));
                try
                {
                    if (euModel != null)
                    {
                        logModel.OperationDetail = "用户姓名:" + euModel.EndUserName + " - STB号:" + euModel.SimCardNo + " - 身份:" + euModel.Identities;
                        MongoDBService.EndUser dc = new MongoDBService.EndUser();
                        {
                            dc.AutoID = euModel.AutoID.ToString();
                            dc.EnduserName = euModel.EndUserName;
                            string[] identityArr = euModel.Identities.Split('|');
                            ArrayOfString aof = new ArrayOfString();
                            foreach (string id in identityArr)
                            {
                                if (id.Equals(""))
                                {
                                    continue;
                                }
                                aof.Add(id);
                            }
                            dc.Identities = aof;
                            dc.IsValid = euModel.IsValid;
                            dc.LastModifyTime = euModel.LastModifyTime;
                            dc.SimCardNo = euModel.SimCardNo;
                            using (MongoDBServiceSoapClient mg = new MongoDBServiceSoapClient())
                            {
                                string rtStr = "";
                                if (mg.SelectEnduserBySimCardNo(euModel.SimCardNo, out rtStr) != null)
                                {
                                    isSyncMg = mg.UpdateEnduser(dc, out rtStr);
                                }
                                else
                                {
                                    isSyncMg = mg.InsertEnduser(dc, out rtStr);
                                }
                                logModel.Memo += rtStr;

                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    logModel.Memo = "异常:" + ex.Message;
                }
                finally
                {
                    if (euModel != null)
                    {
                        log.Add(logModel);
                        if (isSyncMg)
                        {
                            RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cc1", "OpenAlert('恭喜用户同步成功。');", true);
                        }
                        else
                        {
                            RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cc2", "OpenAlert('抱歉!用户同步失败。');", true);
                        }
                    }
                    else
                    {
                        RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "cc2", "OpenAlert('抱歉!用户同步失败。该用户本地已不存在!!');", true);
                    }
                }
            }
        }
Ejemplo n.º 21
0
        private bool UploadMain()
        {
            if (FileUpload1.HasFile)
            {
                string folderPath = Server.MapPath("~/Pdf/");
                //Check whether Directory (Folder) exists.


                if (!Directory.Exists(folderPath))
                {
                    //If Directory (Folder) does not exists. Create it.
                    Directory.CreateDirectory(folderPath);
                }

                FileUpload fu = FileUpload1;

                String   fileExtension     = System.IO.Path.GetExtension(fu.FileName).ToLower();
                String[] allowedExtensions = { ".pdf" };
                for (int i = 0; i < allowedExtensions.Length; i++)
                {
                    if (fileExtension == allowedExtensions[i])
                    {
                        try
                        {
                            ClsModule mdl = new ClsModule();
                            Doc.doc_id           = mdl.getRuningNoDoc();
                            Doc.doc_name         = fu.FileName;
                            Doc.create_by        = Session["NAME"].ToString();
                            Doc.secure_prepare   = Session["EMAIL"].ToString();
                            Doc.attach_file_name = Doc.doc_id + ".zip";
                            Doc.content          = Content.Text;
                            Doc.pr_flag          = 1;
                            Doc.suplier_id       = ddlCustomer.SelectedValue.ToString();
                            Doc.supplier_name    = ddlCustomer.Text;
                            Doc.comment          = comment.Value;
                            string s_newfilename = Doc.doc_id + fileExtension;
                            fu.PostedFile.SaveAs(folderPath + s_newfilename);
                            Thread.Sleep(3000);
                            // Insert DB

                            string     ret;
                            BLL.Upload _BLL = new BLL.Upload();
                            string     temp;

                            ret = _BLL.InsertDocument_step1(Doc);

                            if (ret == "1")
                            {
                                Response.Write("1");
                                Model.Log      L   = new Model.Log();
                                Helper.Utility Log = new Helper.Utility();

                                L.content   = "Upload success.";
                                L.create_by = Session["EMAIL"].ToString();

                                Log.WriteLog(L);



                                PdfToImage("", Doc.doc_id);
                            }
                            else
                            {
                                Model.Log      L   = new Model.Log();
                                Helper.Utility Log = new Helper.Utility();

                                L.content   = "Can not upload.";
                                L.create_by = Session["EMAIL"].ToString();

                                Log.WriteLog(L);
                            }



                            //    lblMessage.Text = Path.GetFileName(FileUpload1.FileName) + " has been uploaded.";
                            //imagepath = ImageSavedPath + s_newfilename;
                            return(true);
                        }
                        catch (Exception ex)
                        {
                            Response.Write(ex.Message);
                            Response.Write("File could not be uploaded.");
                            Response.End();
                            //  return false;
                        }
                    }
                    else
                    {
                        Response.Write("Please upload pdf file only.");
                        return(false);
                    }
                }
                return(true);
            }
            else
            {
                Response.Write("<script>alert('โปรดเลือกเอกสารที่ต้องการ Approve ก่อน');</script>");
                return(false);
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// 添加日志
        /// </summary>
        /// <param name="title"></param>
        /// <param name="contents"></param>
        /// <param name="type"></param>
        /// <param name="oldContents"></param>
        /// <param name="newContents"></param>
        /// <param name="others"></param>
        /// <param name="browseAgent"></param>
        /// <param name="ipAddress"></param>
        /// <param name="url"></param>
        /// <param name="userId"></param>
        /// <param name="userName"></param>
        public static void Add(string title, string contents = "", Type type = Type.其它, string oldContents = "", string newContents = "", string others = "", string browseAgent = "", string ipAddress = "", string url = "", string userId = "", string userName = "")
        {
            Model.Log logModel = new Model.Log
            {
                Id        = Guid.NewGuid(),
                Title     = title,
                Type      = type.ToString(),
                IPAddress = ipAddress.IsNullOrWhiteSpace() ? Tools.GetIP() : ipAddress,
                URL       = url.IsNullOrWhiteSpace() ? Tools.GetAbsoluteURL() : url,
                WriteTime = DateExtensions.Now,
                Referer   = Tools.GetReferer()
            };
            if (userId.IsGuid(out Guid userGuid))
            {
                logModel.UserId = userGuid;
            }
            else
            {
                try
                {
                    Guid uid = User.CurrentUserId;
                    if (uid.IsEmptyGuid())
                    {
                        uid = EnterpriseWeiXin.Common.GetUserId();
                    }
                    if (uid.IsNotEmptyGuid())
                    {
                        logModel.UserId = uid;
                    }
                }
                catch { }
            }
            if (!userName.IsNullOrWhiteSpace())
            {
                logModel.UserName = userName;
            }
            else
            {
                try
                {
                    var userModel = User.CurrentUser;
                    if (null == userModel)
                    {
                        userModel = EnterpriseWeiXin.Common.GetUser();
                    }
                    if (null != userModel)
                    {
                        logModel.UserName = userModel.Name;
                    }
                }
                catch { }
            }

            if (!contents.IsNullOrWhiteSpace())
            {
                logModel.Contents = contents;
            }
            if (!others.IsNullOrWhiteSpace())
            {
                logModel.Others = others;
            }
            if (!oldContents.IsNullOrWhiteSpace())
            {
                logModel.OldContents = oldContents;
            }
            if (!newContents.IsNullOrWhiteSpace())
            {
                logModel.NewContents = newContents;
            }
            logModel.BrowseAgent = browseAgent.IsNullOrWhiteSpace() ? Tools.GetBrowseAgent() : browseAgent;
            AddLog(logModel);
        }
        private void AddDebit()
        {
            if (Validate())
            {
                try {
                    // Recuperando dados
                    Debit debit = new Debit();
                    debit.TotalAmount = double.Parse(valorTotal_txt.Text);
                    debit.StartAmount = double.Parse(valorIncial_txt.Text);
                    debit.PaymentDate = dataPagamento_txt.Text;
                    debit.DueDate     = dataVencimento_txt.Text;
                    debit.Description = descricao_txt.Text;
                    int id_pessoa = dao.GetIdPessoaSuppliier(fornecedor_txt.Text);
                    debit.IdSupplier = dao.GetIdSupplier(id_pessoa);

                    if (debit.IdSupplier == 0)
                    {
                        MessageBox.Show("Fornecedor invalido!!!", "Aviso",
                                        MessageBoxButton.OK, MessageBoxImage.Warning);
                        return;
                    }

                    // Inserindo serviço no banco
                    dao.AddDebit(debit);

                    // Registro de log - Inserção
                    Model.Log added = new Model.Log();
                    added.employe = _employe;
                    added.action  = $"Conta a pagar: {debit.Description} foi cadastrado no sistema!";
                    logs.Register(added);

                    // Atualizando grid e limpando campos de texto
                    RefreshGrid();
                    ClearFields();
                    BlockFields();
                    actionIndex = -1;
                    aux         = null;
                }
                catch (DatabaseInsertException err) {
                    MessageBox.Show(
                        err.Message,
                        "Erro",
                        MessageBoxButton.OK,
                        MessageBoxImage.Error
                        );
                }
                catch (Exception err) {
                    MessageBox.Show(
                        err.Message,
                        "Erro",
                        MessageBoxButton.OK,
                        MessageBoxImage.Error
                        );
                }
            }
            else
            {
                MessageBox.Show(
                    "Há Campos Vazios",
                    "Erro de Prenchimento de Formulário",
                    MessageBoxButton.OK,
                    MessageBoxImage.Warning
                    );
            }
        }
Ejemplo n.º 24
0
        protected void btnSave2_Click(object sender, EventArgs e)
        {
            int dbcount=0;
            BLL.ExtendGame extgame = new BLL.ExtendGame();
            Model.ExtendGame model = new Model.ExtendGame();
            try
            {
                string str = this.hdValue.Value;
                string[] strArr = str.Split(',');
                StringBuilder sqlWehere = new StringBuilder();
                sqlWehere.Append(" UserID='" + hduid.Value + "' and ChanelID='" + hdcid.Value + "' ");
                if (strArr.Length > 1)
                {
                    sqlWehere.Append(" and gameName not in (");
                    for (int i = 0; i < strArr.Length - 1; i++)
                    {
                        if (i == 0)
                        {
                            sqlWehere.Append("'" + strArr[i] + "'");
                        }
                        else
                        {
                            sqlWehere.Append(",'" + strArr[i] + "'");
                        }
                    }
                    sqlWehere.Append(") ");
                }
                extgame.Delete(sqlWehere.ToString());

                if (this.hdValue.Value != "")//计算提交打包数量
                {
                    dbcount = 0;
                    model.Status = "正在打包";
                    model.UpdateType = "N/A";
                    model.UserID = int.Parse(hduid.Value);
                    model.ChanelID = int.Parse(hdcid.Value);
                    model.ChanelName = hdcname.Value;
                    for (int i = 0; i < strArr.Length - 1; i++)
                    {
                        model.UpdateDate = DateTime.Now;
                        model.OnTime = DateTime.Now;
                        model.gameID = 0;
                        model.gameName = strArr[i].Trim();
                        if (!extgame.Exists(int.Parse(hduid.Value), int.Parse(hdcid.Value), model.gameName))
                        {
                            dbcount++;
                        }
                    }
                }

                string countwhere = "[Status] ='正在打包' and ChanelID  ='" + hdcid.Value + "' "; //计算正在打包数量

                if (extgame.GetCount(countwhere) + dbcount > 5)
                {
                    Model.Log modLog = new Model.Log();
                    modLog.UserId = int.Parse(hdcid.Value);
                    modLog.UserName = hdcname.Value;
                    InsertLog(modLog);
                    string myScript = @"alertRedirectMsg('打包序列不能超过5个,请耐心等待!','error.gif','Channel.aspx');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
                }
                else 
                {
                    if (this.hdValue.Value != "")
                    {
                        model.Status = "正在打包";
                        model.UpdateType = "N/A";
                        model.UserID = int.Parse(hduid.Value);
                        model.ChanelID = int.Parse(hdcid.Value);
                        model.ChanelName = hdcname.Value;
                        for (int i = 0; i < strArr.Length - 1; i++)
                        {
                            model.UpdateDate = DateTime.Now;
                            model.OnTime = DateTime.Now;
                            model.gameID = 0;
                            model.gameName = strArr[i].Trim();
                            model.Verifycode = VerifycodeUtils.genVerifycode(6);
                            if (!extgame.Exists(int.Parse(hduid.Value), int.Parse(hdcid.Value), model.gameName))
                            {
                                extgame.Add(model);
                            }
                        }
                    }
               

                    Model.Log modLog = new Model.Log();
                    modLog.UserId = int.Parse(hdcid.Value);
                    modLog.UserName = hdcname.Value;
                    InsertLog(modLog);
                    string myScript = @"alertRedirectMsg('保存成功,系统正为您准备推广包,等待时间约为几分钟......','success.gif','Downloadgames.aspx?cooperateModelId= " + Request.Params["cooperateId"].ToString() + "');";
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true); 
                }
           

                
            }
            catch
            {
                string myScript = @"alertRedirectMsg('保存错误!','error.gif','Channel.aspx');";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", myScript, true);
            }
        }
        /// <summary>
        /// Método para coletar dados e fazer interação com banco para inserção
        /// </summary>
        private void AddClient()
        {
            if (IsValidFields())
            {
                //Recuperando documentos no formato correto
                string doc = docEdit.Text.Replace(".", "").Replace("-", "").Replace("_", ".").Replace("/", "");
                string cep = cepEdit.Text.Replace("-", "").Replace("_", "");

                //Validando os documentos
                if (cbtype.SelectedIndex == 0)
                {
                    if (!Validator.IsCpf(doc))
                    {
                        MessageBox.Show(
                            "CPF Inválido",
                            "Dados incorretos!",
                            MessageBoxButton.OK,
                            MessageBoxImage.Warning);
                        return;
                    }
                }
                else
                {
                    if (!Validator.IsCnpj(doc))
                    {
                        MessageBox.Show(
                            "CNPJ Inválido",
                            "Dados incorretos!",
                            MessageBoxButton.OK,
                            MessageBoxImage.Warning);
                        return;
                    }
                }

                try {
                    //Recuperando dados do cliente
                    Client       cli      = new Client();
                    ComboBoxItem selected = cbState.Items[cbState.SelectedIndex] as ComboBoxItem;
                    cli.adress.street       = AdressEdit.Text;
                    cli.adress.city         = CityEdit.Text;
                    cli.adress.neighborhood = NeighboorhoodEdit.Text;
                    cli.adress.number       = NumberEdit.Text;
                    cli.adress.UF           = selected.Content.ToString();
                    cli.adress.CEP          = cep;
                    cli.name            = NameEdit.Text;
                    cli.docNumber       = doc;
                    cli.cellNumber      = phone2Edit.Text;
                    cli.residenceNumber = phone1Edit.Text;
                    cli.description     = descEdit.Text;
                    cli.stateId         = stateEdit.Text;
                    if (cbActive.SelectedIndex == 1)
                    {
                        cli.Inactivate();
                    }
                    if (cbtype.SelectedIndex == 1)
                    {
                        cli.SetPhysical(false);
                    }

                    //Inserindo registro no banco
                    dao.AddClient(cli);

                    //Registrando log de alteração
                    Model.Log added = new Model.Log();
                    added.employe = _employe;
                    added.action  = $"Cliente {cli.name} foi cadastrado no sistema!";
                    logs.Register(added);

                    //Atualizando grid e limpando campos de texto
                    RefreshGrid();
                    ClearFields();
                    BlockFields();
                    actionIndex = -1;
                    aux         = null;
                }
                catch (DatabaseInsertException err) {
                    MessageBox.Show(
                        err.Message,
                        "Erro ao gravar dados",
                        MessageBoxButton.OK,
                        MessageBoxImage.Error
                        );
                }
            }
            else
            {
                MessageBox.Show(
                    "Há Campos Vazios",
                    "Erro de Prenchimento de Formulário",
                    MessageBoxButton.OK,
                    MessageBoxImage.Warning
                    );
            }
        }
Ejemplo n.º 26
0
        protected void RbtnSubmit_Click(object sender, EventArgs e)
        {
            string msgType = RCB_Type.SelectedValue;
            string closeBy = "";
            if (msgType.Equals("Popup"))
            {
                closeBy = RCB_DisType.SelectedValue;
            }
            else if (msgType.Equals("Roll"))
            {
                if (!RadButton2.Checked && RTB_RollTimes.Text.Trim().Equals(""))
                {
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('滚动次数不能为空!');", true);
                    return;
                }
                closeBy = RadButton2.Checked ? "-1" : RTB_RollTimes.Text;
            }
            if (RadDatePicker1.DbSelectedDate == null)
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c", "OpenAlert('抱歉,有效期限不能为空!');", true);
                return;
            }
            DateTime availableTime = (DateTime)RadDatePicker1.DbSelectedDate;
            DateTime expiredTime = RadDatePicker2.DbSelectedDate==null? new DateTime(2050,12,31) : (DateTime)RadDatePicker2.DbSelectedDate;
            string content = TabStrip1.SelectedTab.Value.Equals("2") ? (RadButton1.Checked ? CheckStr(ContentEditor.Content) : ContentEditor.Content) : ContentText.Text;
            if (content.Trim().Equals(""))
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('抱歉,公告内容不能为空!');", true);
                return;
            }
            RadTreeView regionTreeView = RadDropDownTree1.Controls[0] as RadTreeView;
            if (!RadButton5.Checked && RadListBox1.CheckedItems.Count == 0 && regionTreeView.SelectedNodes.Count == 0 && RTB_SIM.Text.Trim().Equals(""))
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('抱歉,请设置对象发送条件!!');", true);
                return;
            }
            if (!RadButton5.Checked && !RadButton3.Checked && !RadButton4.Checked)
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('抱歉,请选择对象条件关系!!');", true);
                return;
            }
            Model.Message msgModel = new Model.Message();
            msgModel.Contents = content;
            msgModel.MessageType = msgType;
            msgModel.DataType = TabStrip1.SelectedTab.Value.Equals("2") ? "DataType_Html" : "DataType_Text";
            msgModel.AndOr = RadButton3.Checked;
            msgModel.AvailableTime = availableTime;
            msgModel.DisappearType = closeBy;
            msgModel.ExpiredTime = expiredTime;
            msgModel.IsValid = true;
            msgModel.LastModifyTime = DateTime.Now;
            msgModel.Memo = "";
            msgModel.Orders = 0;
            msgModel.Publisher = user.UserInfo.UserID;
            long msgId = 0;
            bool isAdd = false;
            Model.Log logModel = new Model.Log();
            try
            {
                logModel.OperationItem = "添加公告";
                logModel.Operator = user.UserInfo.UserID;
                logModel.OperationTime = DateTime.Now;
                logModel.OperationDetail =  "类型:"+msgType ;
                msgId =msg.Add(msgModel);
                if (msgId > 0)
                {
                    if (RadButton5.Checked)
                    {
                        Model.MessageToObject mtoModel = new Model.MessageToObject();
                        mtoModel.MsgID = msgId;
                        mtoModel.ObjType = "2";
                        mtoModel.ObjValue = "";
                        isAdd = mto.Add(mtoModel);
                    }
                    else
                    {
                        //身份
                        isAdd = true;
                        foreach (RadListBoxItem rbi in RadListBox1.CheckedItems)
                        {
                            isAdd = false;
                            Model.MessageToObject mtoModel = new Model.MessageToObject();
                            mtoModel.MsgID = msgId;
                            mtoModel.ObjType = "0";
                            mtoModel.ObjValue = rbi.Value;
                            isAdd = mto.Add(mtoModel);
                            if (!isAdd)
                            {
                                break;
                            }
                        }
                        //区域
                        if (isAdd)
                        {
                            isAdd = true;
                            if (!regionTreeView.SelectedValue.Equals("Area_Jfs"))
                            {
                                isAdd = false;
                                Model.MessageToObject mtoModel = new Model.MessageToObject();
                                mtoModel.MsgID = msgId;
                                mtoModel.ObjType = "0";
                                mtoModel.ObjValue = regionTreeView.SelectedValue;
                                isAdd = mto.Add(mtoModel);
                            }
                        }
                        //用户
                        if (isAdd)
                        {
                            isAdd = true;
                            if (RTB_SIM.Text.Trim() != "")
                            {
                                string[] SimNoArr = RTB_SIM.Text.Split(',');
                                foreach (string simNo in SimNoArr)
                                {
                                    if (!simNo.Trim().Equals(""))
                                    {
                                        isAdd = false;
                                        Model.MessageToObject mtoModel = new Model.MessageToObject();
                                        mtoModel.MsgID = msgId;
                                        mtoModel.ObjType = "1";
                                        mtoModel.ObjValue = simNo.Trim();
                                        isAdd = mto.Add(mtoModel);
                                        if (!isAdd)
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                        }

                    }
                }
                if (msgId != 0 && isAdd)
                {
                    logModel.Memo = "成功";
                }
                else
                {
                    logModel.Memo = "失败!";
                }
            }
            catch (Exception ex)
            {
                logModel.Memo = "异常:" + ex.Message;
            }
            finally
            {
                log.Add(logModel);
                if (msgId != 0 && isAdd)
                {
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c", "OpenAlert('恭喜!编辑成功!');", true);
                }
                else
                {
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c3", "OpenAlert('抱歉!编辑失败!');", true);
                }
            }
        }
Ejemplo n.º 27
0
        protected void Btn_Click(object sender, EventArgs e)
        {
            int tid = Util.DataConverter.ToLng(HiddenField1.Value);
            task = TaskBll.GetTask(tid,true);

            if (task == null)
            {
                WriteMessage("无法获取有效的任务信息", false);
            }
            Model.Log log = null;
            string msg = "";
            Button btn = sender as Button;
            switch (btn.CommandName)
            {
                case "BeginDesign":
                    log = new Model.Log();
                    log.AddTime = DateTime.Now;
                    log.StartUserName = RequestContext.Current.User.UserName;
                    log.Type = Model.LogType.Main;
                    log.Action = Model.LogAction.Design;
                    log.RangeBegin = DateTime.Now;
                    log.Title = "任务(编码:" + task.Code + ")设计记录";
                    log.Extend = task.ModifyTimes;
                    task.Status = Model.TaskState.Designing;
                    task.Logs.Add(log);
                    msg = "任务进入设计阶段";
                    break;
                case "DesignEnd":
                    log = task.Logs.OrderByDescending(m => m.Id).FirstOrDefault(m => m.Action == Model.LogAction.Design && !m.RangeEnd.HasValue);
                    if (log == null)
                    {
                        WriteMessage("当前无可用数据", false);
                    }

                    log.RangeEnd = DateTime.Now;
                    log.EndUserName = RequestContext.Current.User.UserName;
                    task.Status = Model.TaskState.DesignEnd;
                    msg = "任务设计阶段结束,等待制版";
                    break;
                case "BeginPlate":
                    log = new Model.Log();
                    log.AddTime = DateTime.Now;
                    log.StartUserName = RequestContext.Current.User.UserName;
                    log.Type = Model.LogType.Main;
                    log.Action = Model.LogAction.Plate;
                    log.RangeBegin = DateTime.Now;
                    log.Title = "任务(编码:" + task.Code + ")制版记录";
                    task.Status = Model.TaskState.Plating;
                    log.Extend = task.ModifyTimes;
                    task.Logs.Add(log);
                    msg = "任务进入制版阶段";
                    break;
                case "PlateEnd":
                    log = task.Logs.OrderByDescending(m => m.Id).FirstOrDefault(m => m.Action == Model.LogAction.Plate && !m.RangeEnd.HasValue);
                    if (log == null)
                    {
                        WriteMessage("当前无可用数据", false);
                    }

                    log.RangeEnd = DateTime.Now;
                    log.EndUserName = RequestContext.Current.User.UserName;
                    task.Status = Model.TaskState.PlateEnd;
                    msg = "任务制版阶段结束,等待打样生产";
                    break;
                case "BeginSample":
                    log = new Model.Log();
                    log.AddTime = DateTime.Now;
                    log.StartUserName = RequestContext.Current.User.UserName;
                    log.Type = Model.LogType.Main;
                    log.Action = Model.LogAction.Sample;
                    log.RangeBegin = DateTime.Now;
                    log.Title = "任务(编码:" + task.Code + ")打样生产记录";
                    task.Status = Model.TaskState.Sampling;
                    log.Extend = task.ModifyTimes;
                    task.Logs.Add(log);

                    msg = "任务进入打样生产阶段";
                    break;
                case "SampleEnd":
                    log = task.Logs.OrderByDescending(m => m.Id).FirstOrDefault(m => m.Action == Model.LogAction.Sample && !m.RangeEnd.HasValue);
                    if (log == null)
                    {
                        WriteMessage("当前无可用数据", false);
                    }

                    log.RangeEnd = DateTime.Now;
                    log.EndUserName = RequestContext.Current.User.UserName;
                    task.Status = Model.TaskState.SampleEnd;
                    msg = "任务打样生产阶段结束,可交付";
                    break;
                case "BeginPackage":
                    log = new Model.Log();
                    log.AddTime = DateTime.Now;
                    log.StartUserName = RequestContext.Current.User.UserName;
                    log.Type = Model.LogType.Main;
                    log.Action = Model.LogAction.Package;
                    log.RangeBegin = DateTime.Now;
                    log.Title = "任务(编码:" + task.Code + ")交付记录";
                    task.Status = Model.TaskState.Packageing;
                    log.Extend = task.ModifyTimes;
                    task.Logs.Add(log);
                    msg = "任务进入交付阶段";
                    break;
                case "PackageEnd":
                    log = task.Logs.OrderByDescending(m => m.Id).FirstOrDefault(m => m.Action == Model.LogAction.Package && !m.RangeEnd.HasValue);
                    if (log == null)
                    {
                        WriteMessage("当前无可用数据", false);
                    }

                    log.RangeEnd = DateTime.Now;
                    log.EndUserName = RequestContext.Current.User.UserName;

                    //客户确认操作记录
                    Model.Log customLog = new Model.Log();
                    customLog.Action = Model.LogAction.CustomConfirm;
                    customLog.AddTime = DateTime.Now;
                    customLog.Extend = task.ModifyTimes;
                    customLog.RangeBegin = DateTime.Now;
                    customLog.Title = "任务(编码:" + task.Code + ")客户确认记录";
                    customLog.Type = Model.LogType.Main;
                    customLog.StartUserName = RequestContext.Current.User.UserName;
                    task.Logs.Add(customLog);

                    task.Status = Model.TaskState.PackageEndAndWaitConfirm;
                    msg = "任务交付阶段结束,等待客户确认";
                    break;
                default:
                    WriteMessage("无法确定当前任务状态", false);
                    break;
            }

            bool flag = TaskBll.UpdateTask(task);

            if (flag)
            {
                WriteMessage(msg, true);
            }
            WriteMessage("操作过程中发生问题", false);
        }
Ejemplo n.º 28
0
        private bool PdfToImage(string pdfName, string fileCurrentName)
        {
            int desired_x_dpi = 300;
            int desired_y_dpi = 300;

            int    pageCount  = 1;
            string ServerPath = Server.MapPath(".\\");
            string pdfPath    = Server.MapPath("~/Pdf/" + fileCurrentName + ".pdf");

            PdfSharp.Pdf.PdfDocument inputDocument = PdfReader.Open(pdfPath, PdfDocumentOpenMode.ReadOnly);
            int widthPage = 0;

            widthPage = (int)inputDocument.Pages[0].Width;
            if (widthPage > 800)
            {
                paper_type = "L";
            }
            else
            {
                paper_type = "P";
            }



            using (var rasterizer = new GhostscriptRasterizer())
            {
                rasterizer.Open(pdfPath);
                pageCount = rasterizer.PageCount;
                for (var pageNumber = 1; pageNumber <= rasterizer.PageCount; pageNumber++)
                {
                    if (rasterizer.PageCount > 1)
                    {
                        var pageFilePath = Path.Combine(Server.MapPath("~/PdfToImage/"), fileCurrentName + "_" + (pageNumber) + ".PNG");
                        var img          = rasterizer.GetPage(desired_x_dpi, desired_y_dpi, pageNumber);
                        img.Save(pageFilePath);
                    }
                    else
                    {
                        var pageFilePath = Path.Combine(Server.MapPath("~/PdfToImage/"), fileCurrentName + ".PNG");
                        var img          = rasterizer.GetPage(desired_x_dpi, desired_y_dpi, pageNumber);
                        img.Save(pageFilePath);
                    }
                }
            }



            Model.Criteria.Document doc = new Model.Criteria.Document();
            doc.doc_id      = fileCurrentName;
            doc.upload_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            doc.page_count  = pageCount;
            doc.paper_type  = paper_type;

            BLL.Upload _BLL = new BLL.Upload();


            _BLL.Update_upload_date(doc);


            // Write LOG

            Model.Log      L   = new Model.Log();
            Helper.Utility Log = new Helper.Utility();

            L.content   = "Convert PDF to Image success.";
            L.create_by = Session["EMAIL"].ToString();

            Log.WriteLog(L);

            return(true);
        }
Ejemplo n.º 29
0
        void testPostback()
        {
            string currentFile = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "/tmpFrmApplication.html";
            //string currentFile = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "/testHtml.html";
            var url      = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "/PO_FrmApplicationRequest.aspx?doc_id=" + doc_id.Value + "&signature=" + signature_file.Value + "&page_count=" + page_count.Value + "&paper_type=" + paper_type.Value;
            var http     = (HttpWebRequest)WebRequest.Create(url);
            var response = http.GetResponse();

            var    stream  = response.GetResponseStream();
            var    sr      = new StreamReader(stream);
            string content = sr.ReadToEnd();

            Int32  pos_start, pos_stop;
            string MidString;

            pos_start = content.IndexOf("submit", 0);
            pos_stop  = content.IndexOf("/>", pos_start);
            MidString = content.Substring(pos_start - 13, (pos_stop + 2) - (pos_start - 13));
            content   = content.Replace(MidString, "");
            //content = content.Replace("Images/", "Images/" + signature_file.Value);
            //content = content.Replace("PdfToImage/", "PdfToImage/" + doc_id.Value);
            content = content.Replace("top:123px", "top:" + dTop.Value.Replace("'", ""));
            content = content.Replace("left:123px", "left:" + dLeft.Value.Replace("'", ""));
            content = content.Replace("hidden='hidden'", "");
            content = content.Replace("<div class='row vertical-center-row'><div class='text-center col-md-1 col-md-offset-1'></div></div></div>", "");
            //if (paper_type.Value =="L")
            //{
            //    content = content.Replace("width='790'", "width='1120'");
            //    content = content.Replace("height='1120'", "height='790'");
            //}
            string path = System.AppDomain.CurrentDomain.BaseDirectory + "tmpFrmApplication.html";

            System.IO.File.WriteAllText(path, content);



            // test git

            //   string currentFile = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath + "/tmpFormApplication.html";
            //DateTime time = DateTime.Now;
            //string format = "M-d-h-mm-ss";
            //string tmp = time.ToString(format);



            if (HtmlToPdf(currentFile, doc_id.Value, paper_type.Value))
            {
                Model.Log      L   = new Model.Log();
                Helper.Utility Log = new Helper.Utility();

                L.content   = "Sign PO request success.";
                L.create_by = Session["EMAIL"].ToString();
                Log.WriteLog(L);

                Model.PO_Document _Doc = new Model.PO_Document();
                BLL.PO            _BLL = new BLL.PO();

                _Doc.sign_prepare_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                _Doc.doc_id            = doc_id.Value;
                _BLL.Update_sign_prepare_date(_Doc);


                PdfToImage("", _Doc.doc_id);

                Response.Redirect("./PO_DataDocument.aspx");

//Response.Redirect("./PdfPrepare/" + doc_id.Value + ".Pdf");
            }
            else
            {
                // Response.Redirect("./PdfPrepare/" + doc_id.Value + ".Pdf");
            }
        }
        protected void btnCommit_Click(object sender, EventArgs e)
        {
            Model.Log log = new Model.Log();

            int meetingApplyFormID = int.Parse(this.hfdMeetingApplyFormID.Value);

            Model.Meeting meeting = BusinessLogic.Meeting.GetApplyMeetingInfoByMeeingID(meetingApplyFormID);
            meeting.MeetingApplyFormID = meetingApplyFormID;
            meeting.WFID = BusinessLogic.Meeting.GetGuidByApplyForm(meetingApplyFormID);
            if (rbtAgree.Checked)
            {
                //同意
                meeting.MeetingStatus = 4;
                //todo  发送邮件给与会者
                MailModel             mailModel        = new MailModel();
                Model.Meeting         me               = BusinessLogic.Meeting.GetApplyMeetingInfoByMeeingID(meetingApplyFormID);
                List <Model.UserInfo> UserEmailAndName = BusinessLogic.MeetingUser.GetUserEmailAndNameByMeetingApplyFormID(meetingApplyFormID);
                #region E-Mail Body
                System.Text.StringBuilder sbMailBody = new System.Text.StringBuilder();
                sbMailBody.Append("您好!");
                sbMailBody.Append("");
                sbMailBody.Append("邀请您参加");
                sbMailBody.Append(meeting.BeginTime);
                sbMailBody.Append("到");
                sbMailBody.Append(meeting.EndTime);
                sbMailBody.Append(",在");
                sbMailBody.Append(BusinessLogic.MeetingRoom.GetMeetingRoomNameByMeetingApplyFormID(meetingApplyFormID));
                sbMailBody.Append("召开的会议。谢谢!如有事情耽搁,请与");
                sbMailBody.Append(BusinessLogic.MeetingUser.GetUserEmailAndNameByMeetingApplyFormID(meetingApplyFormID).ToArray()[0].UserEmail);
                sbMailBody.Append("这个Email联系。");
                #endregion
                mailModel.MailFrom    = ConfigurationManager.AppSettings["commomEmail"].ToString();
                mailModel.Password    = ConfigurationManager.AppSettings["emailPassword"].ToString();
                mailModel.SmtpServer  = ConfigurationManager.AppSettings["smtpServer"].ToString();
                mailModel.SmtpPort    = int.Parse(ConfigurationManager.AppSettings["port"].ToString());
                mailModel.DisplayName = "会议邀请";
                mailModel.MailBcc     = null;
                mailModel.MailCc      = null;
                mailModel.MailSubject = meeting.MeetingTopic;
                mailModel.MailBody    = sbMailBody.ToString();
                mailModel.MailTo      = null;//此处留空,在SendEmail里才会赋值
                mailModel.SmtpPort    = 25;
                mailModel.SmtpSsl     = false;
                mailModel.UserName    = ConfigurationManager.AppSettings["userName"].ToString();
                try
                {
                    SendEmail.SendEmailTo(UserEmailAndName, mailModel);
                    lblMessage.Text = "会议设备安排成功!";
                }
                catch (YunShanOA.Common.SendMailFailExecpion sendMailFail)
                {
                    log            = new Model.Log();
                    log.LogContext = sendMailFail.Message;
                    log.LogTime    = System.DateTime.Now;
                    log.userName   = Page.User.Identity.Name;
                    log.LogTypeID  = "1";
                    BusinessLogic.Log.SaveLog(log);
                    lblMessage.Text = "发送邮件出现异常,请联系申请人重新申请!申请人Email:" + BusinessLogic.MeetingUser.GetUserEmailByUserName(log.userName);
                }
            }
            else
            {
                //不同意
                meeting.MeetingStatus = 3;
                Dictionary <int, int> meetingIDAndName = BusinessLogic.MeetingEquipment.GetMeetingEquipmentIDAndCount(meetingApplyFormID);
                foreach (var m in meetingIDAndName)
                {
                    BusinessLogic.MeetingEquipment.ReturnEquipmentCount(m.Key, m.Value);
                }
            }
            //todo 更新MeetingAndRoom里的状态,有待测试
            lblMessage.Text = "会议设备处理成功";
            //更新MeetingAndRoom表里的状态
            BusinessLogic.MeetingRoom.UpdateMeetingAndRoomStatus(meetingApplyFormID, meeting.MeetingStatus);
            BusinessLogic.Meeting.UpdateMeetingApplyFormStatus(meetingApplyFormID, meeting.MeetingStatus);
            Server.Transfer("~/OfficeAdmin/ProcessMeetingEquipmentArr.aspx");
        }
Ejemplo n.º 31
0
 /// <summary>
 /// Map a Log database Model object to a View Model object for presentation
 /// </summary>
 /// <param name="item">database model object</param>
 /// <returns>view model presentation object</returns>
 public static ViewModel.Logging.Log ToViewModel(this Model.Log item)
 {
     return(Mapper.Map <ViewModel.Logging.Log>(item));
 }
Ejemplo n.º 32
0
        protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            GridDataItem dataItem = null;

            if (e.Item is GridDataItem)
            {
                dataItem = e.Item as GridDataItem;

                int selectedRowIndex = dataItem.RowIndex;
            }



            if (e.CommandName == "PDF_PREPARE2")
            {
                string filename = e.CommandArgument.ToString();
                if (filename != "")
                {
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();

                    L.content   = "View Prepare " + filename + ".pdf";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);
                    string path = MapPath("Pdf/" + filename + ".pdf");

                    //if (!File.Exists(path))
                    //{
                    //    Response.Write("<script>alert('ไฟล์นี้ยังไม่ได้ถูก Sign prepare.');</script>");
                    //    return;
                    //}

                    byte[] bts = System.IO.File.ReadAllBytes(path);
                    Response.Clear();
                    Response.ClearHeaders();
                    Response.AddHeader("Content-Type", "Application/octet-stream");
                    Response.AddHeader("Content-Length", bts.Length.ToString());
                    Response.AddHeader("Content-Disposition", "attachment;   filename=" + filename + ".pdf");
                    Response.BinaryWrite(bts);
                    Response.Flush();
                    Response.End();
                }
            }



            // Attath file
            if (e.CommandName == "lnkDownload")
            {
                // ajxMgr.ResponseScripts.Add((string.Format("alert('Hello from the server! Server time is {0}');", DateTime.Now.ToLongTimeString())));
                try
                {
                    string filename = e.CommandArgument.ToString();
                    if (filename != "")
                    {
                        Model.Log      L   = new Model.Log();
                        Helper.Utility Log = new Helper.Utility();

                        L.content   = "Download attach file name " + filename + ".zip";
                        L.create_by = Session["EMAIL"].ToString();
                        Log.WriteLog(L);
                        string path = MapPath("AttachFiles/" + filename + ".zip");
                        byte[] bts  = System.IO.File.ReadAllBytes(path);
                        Response.Clear();
                        Response.ClearHeaders();
                        Response.AddHeader("Content-Type", "Application/octet-stream");
                        Response.AddHeader("Content-Length", bts.Length.ToString());
                        Response.AddHeader("Content-Disposition", "attachment;   filename=" + filename + ".zip");
                        Response.BinaryWrite(bts);
                        Response.Flush();
                        Response.End();
                    }
                }
                catch (FileNotFoundException exeception)
                {
                }
            }



            if (e.CommandName == "step22")
            {
                //GridDataItem dataItem =null;
                DataTable _dt;
                _dt = (DataTable)Session["DT"];
                int index = Convert.ToInt32(e.CommandArgument);

                ////if (e.Item is GridDataItem)
                ////{
                ////dataItem  = e.Item as GridDataItem;

                ////    int selectedRowIndex = dataItem.RowIndex;

                ////}



                if (dataItem.Cells[4].Text != Session["EMAIL"].ToString())
                {
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "[Access denied!] Go to FrmApplicationPrepare.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);

                    Response.Write("<script>alert('คุณไม่มีสิทธิ์ Sign prepare.');</script>");
                }

                else if (_dt.Rows[index]["step2"].ToString() == "1")
                {
                    Response.Write("<script>alert('คุณไม่สามารถ Sign prepare ได้เนื่องจาก Sign ไปแล้ว');</script>");
                }

                else
                {
                    string page_count = "";
                    string doc_id;
                    string signature;
                    string paper_type;

                    BLL.Upload _BLL = new BLL.Upload();

                    doc_id     = dataItem.Cells[0].Text;
                    page_count = _BLL.get_Pagecount(doc_id);
                    paper_type = _BLL.Get_Paper_type(doc_id);
                    signature  = Session["SIGNATURE"].ToString();
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "Go to FrmApplicationPrepare.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);
                    Response.Redirect("FrmApplicationRequest.aspx?doc_id=" + doc_id + "&signature=" + signature + "&page_count=" + page_count + "&paper_type=" + paper_type);
                }
            }



            if (e.CommandName == "step2")
            {
                int idx = Convert.ToInt32(e.CommandArgument);


                if (Session["LEVEL"].ToString() != "2")
                {
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "[Access denied!] Go to sendMailRequest.aspx.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);

                    Response.Write("<script>alert('คุณไม่มีสิทธิ์ส่งเมล์เพื่อ Request.');</script>");
                }



                else if (e.CommandArgument.ToString() == "1")
                {
                    Response.Write("<script>alert('คุณไม่สามารถส่งเมล์ได้เนื่องจากส่งไปแล้ว');</script>");
                }


                else
                {
                    string doc_id;
                    string email;
                    string content;

                    doc_id  = dataItem.Cells[2].Text;
                    email   = Session["EMAIL"].ToString();
                    content = dataItem.Cells[4].Text;

                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "Go to SendMailRequest.aspx.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);
                    Response.Redirect("SendMailRequest.aspx?doc_id=" + doc_id + "&email=" + email + "&content=" + content);
                }
            }


            if (e.CommandName == "step3")
            {
                if (!Convert.ToBoolean(DataBinder.Eval(dataItem.DataItem, "step2")))
                {
                    RadWindowManager1.RadAlert("ไม่สามารถส่งเมล์ Review ได้ต้องทำการ Request ก่อน", 200, 100, "Alert", "callBackFn");
                    return;
                }

                int idx = Convert.ToInt32(e.CommandArgument);
                if (Session["LEVEL"].ToString() != "2")
                {
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "[Access denied!] Go to sendMailReview.aspx.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);

                    Response.Write("<script>alert('คุณไม่มีสิทธิ์ส่งเมล์เพื่อ Review.');</script>");
                }

                //else if (  e.CommandArgument.ToString() == "1")
                //{
                //    Response.Write("<script>alert('คุณไม่สามารถส่งเมล์ได้เนื่องจากส่งไปแล้ว');</script>");
                //}

                else
                {
                    string doc_id;
                    string email;
                    string content;

                    doc_id  = dataItem.Cells[2].Text;
                    email   = Session["EMAIL"].ToString();
                    content = dataItem.Cells[4].Text;

                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "Go to SendMailReview.aspx.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);
                    Response.Redirect("SendMailReview.aspx?doc_id=" + doc_id + "&email=" + email + "&content=" + content);
                }
            }

            if (e.CommandName == "step4")
            {
                if (!Convert.ToBoolean(DataBinder.Eval(dataItem.DataItem, "step3")))
                {
                    RadWindowManager1.RadAlert("ไม่สามารถส่งเมล์ Approve ได้ต้องทำการ Review ก่อน", 200, 100, "Alert", "callBackFn");
                    return;
                }


                int idx = Convert.ToInt32(e.CommandArgument);
                if (Session["LEVEL"].ToString() != "2")
                {
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "[Access denied!] Go to sendMailReview.aspx.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);

                    Response.Write("<script>alert('คุณไม่มีสิทธิ์ส่งเมล์เพื่อ Review.');</script>");
                }

                //else if (  e.CommandArgument.ToString() == "1")
                //{
                //    Response.Write("<script>alert('คุณไม่สามารถส่งเมล์ได้เนื่องจากส่งไปแล้ว');</script>");
                //}

                else
                {
                    string doc_id;
                    string email;
                    string content;

                    doc_id  = dataItem.Cells[2].Text;
                    email   = Session["EMAIL"].ToString();
                    content = dataItem.Cells[4].Text;

                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "Go to SendMailApprove.aspx.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);
                    Response.Redirect("SendMailApprove.aspx?doc_id=" + doc_id + "&email=" + email + "&content=" + content);
                }
            }



            if (e.CommandName == "PDF_APPROVE")
            {
                try
                {
                    string filename = e.CommandArgument.ToString();
                    if (filename != "")
                    {
                        Model.Log      L   = new Model.Log();
                        Helper.Utility Log = new Helper.Utility();

                        L.content   = "View PR Complete  " + filename + ".pdf";
                        L.create_by = Session["EMAIL"].ToString();
                        Log.WriteLog(L);
                        string path = MapPath("PdfApprove/" + filename + ".pdf");

                        //if (!File.Exists(path))
                        //{
                        //    Response.Write("<script>alert('ไฟล์นี้ยังไม่ได้ถูก Sign prepare.');</script>");
                        //    return;
                        //}

                        byte[] bts = System.IO.File.ReadAllBytes(path);
                        Response.Clear();
                        Response.ClearHeaders();
                        Response.AddHeader("Content-Type", "Application/octet-stream");
                        Response.AddHeader("Content-Length", bts.Length.ToString());
                        Response.AddHeader("Content-Disposition", "attachment;   filename=" + filename + ".pdf");
                        Response.BinaryWrite(bts);
                        Response.Flush();
                        Response.End();
                    }
                }
                catch (FileNotFoundException exception)
                {
                }
            }


            if (e.CommandName == "OPEN_PO")
            {
                if (Convert.ToBoolean(DataBinder.Eval(dataItem.DataItem, "step4")))
                {
                    string filename = e.CommandArgument.ToString();
                    if (filename != "")
                    {
                        Response.Redirect("Upload_PO.aspx?doc_id=" + filename + "&content=" + dataItem.Cells[4].Text);
                    }
                }
                else
                {
                    RadWindowManager1.RadAlert("ไม่สามารถเปิด PO ได้ต้องทำ PR ให้เสร็จทุกขั้นตอนก่อน", 200, 100, "Alert", "callBackFn");
                    return;
                }
            }
        }
Ejemplo n.º 33
0
 protected void rbtnSubmit_Click(object sender, EventArgs e)
 {
     string title = RTB_Title.Text;
     if (title.Trim().Equals(""))
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('抱歉,标题不能为空!');", true);
         return;
     }
     SmartLaw.Model.Questionary qnModel = qn.GetQnModel(QnID);
     List<SmartLaw.Model.Question> qsModelList = qn.GetQsModelList(1, QnID.ToString());
     List<SmartLaw.Model.Question> qsnewModelList = new List<Model.Question>();
     if (!RadButton2.Checked)
     {
         qnModel.IsValid = true;
         for (int i = 0; i < RadGrid1.Items.Count; i++)
         {
             RadTextBox idbox = (RadTextBox)RadGrid1.Items[i].FindControl("idbox");
             SmartLaw.Model.Question qsM = new Model.Question();
             long iid = long.Parse(idbox.Text);
             if (iid != -1)
             {
                 qsM = qn.GetQsModel(iid);
             }
             else
             {
                 qsM.ID = -1;
             }
             qsM.Orders = i;
             RadTextBox box = (RadTextBox)RadGrid1.Items[i].FindControl("content");
             string Content = box.Text;
             if (Content.Trim() == "")
             {
                 RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('抱歉,问题不能为空!');", true);
                 return;
             }
             qsM.Content = Content;
             RadTextBox box1 = (RadTextBox)RadGrid1.Items[i].FindControl("answer1");
             string Answer1 = box1.Text;
             RadTextBox box2 = (RadTextBox)RadGrid1.Items[i].FindControl("answer2");
             string Answer2 = box2.Text;
             RadTextBox box3 = (RadTextBox)RadGrid1.Items[i].FindControl("answer3");
             string Answer3 = box3.Text;
             RadTextBox box4 = (RadTextBox)RadGrid1.Items[i].FindControl("answer4");
             string Answer4 = box4.Text;
             StringBuilder ansSb = new StringBuilder();
             if (Answer1.Trim() != "")
             {
                 ansSb.Append(Answer1.Trim() + "|");
             }
             if (Answer2.Trim() != "")
             {
                 ansSb.Append(Answer2.Trim() + "|");
             }
             if (Answer3.Trim() != "")
             {
                 ansSb.Append(Answer3.Trim() + "|");
             }
             if (Answer4.Trim() != "")
             {
                 ansSb.Append(Answer4.Trim() + "|");
             }
             if (ansSb.ToString().Equals(""))
             {
                 RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('抱歉,一个问题至少有一个选项!');", true);
                 return;
             }
             string[] ans = ansSb.ToString().Substring(0, ansSb.ToString().Length - 1).Split('|');
             qsM.Answer = ans;
             RadButton rbt = RadGrid1.Items[i].FindControl("RadButton3") as RadButton;
             qsM.IsSingle = rbt.Checked;
             qsM.QuestionaryID = QnID;
             qsnewModelList.Add(qsM);
         }
     }
     else
     {
         qnModel.IsValid = false;
     }
     SmartLaw.Model.Log logM = new Model.Log();
     logM.OperationItem = "修改调查问卷";
     logM.OperationDetail = "标题:" + title;
     logM.OperationTime = DateTime.Now;
     logM.Operator = user.UserInfo.UserID;
     logM.Memo = "";
     bool isUpdate = false;
     try
     {
         qnModel.Title = title;
         if (qnModel.IsValid)
         {
             isUpdate = qn.UpdateQuestionary(qnModel);
             if (isUpdate)
             {
                 List<long> oldIds = new List<long>();
                 foreach (SmartLaw.Model.Question qsM in qsnewModelList)
                 {
                     if (qsM.ID != -1)
                     {
                         isUpdate = false;
                         oldIds.Add(qsM.ID);
                         isUpdate = qn.UpdateQuestion(qsM);
                         if (!isUpdate)
                         {
                             break;
                         }
                     }
                     else
                     {
                         if (qn.AddQuestion(QnID, qsM) == 0)
                         {
                             isUpdate = false;
                             break;
                         }
                     }
                 }
                 foreach (SmartLaw.Model.Question qsoldM in qsModelList)
                 {
                     if (!oldIds.Contains(qsoldM.ID))
                     {
                         qn.DeleteQuestion(qsoldM.ID);
                     }
                 }
             }
         }
         else
         {
             if (qsModelList.Count > 0)
             {
                 isUpdate = qn.DeleteAllQuestionsInQn(QnID);
             }
             if (isUpdate)
             {
                 isUpdate = qn.UpdateQuestionary(qnModel);
             }
         }
         if (isUpdate)
         {
             logM.Memo += "成功";
         }
         else
         {
             logM.Memo += "失败";
         }
     }
     catch (Exception ex)
     {
         logM.Memo += ex.Message;
     }
     finally
     {
         log.Add(logM);
         if (isUpdate)
         {
             RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c", "OpenAlert('恭喜!修改成功!');", true);
         }
         else
         {
             RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c3", "OpenAlert('抱歉!修改失败!');", true);
         }
     }
 }
Ejemplo n.º 34
0
 public void WriteLog(Model.Log Log)
 {
     _DAL.WriteLog(Log);
 }
Ejemplo n.º 35
0
 /// <summary>
 /// 添加日志
 /// </summary>
 /// <param name="log"></param>
 public static void Add(Model.Log log)
 {
     Task task = Task.Run(() => AddLog(log));
 }
Ejemplo n.º 36
0
        protected void Bt_Add_Click(object sender, EventArgs e)
        {
            string sysCodeDetailID = TB_SubCodeName.Text.Trim();
            string sysCodeDetailContext = TB_SubCodeContent.Text.Trim();
            bool isValid = RCB_Enable.SelectedValue.Trim() == "1" ? true : false;
            string memo = TB_SubCodeMemo.Text.Trim();
            string matchPass_SubCodeName = @"^[a-z0-9A-Z_-]{1,50}$";

            if (sysCodeDetailID == "" || !(Regex.IsMatch(sysCodeDetailID, matchPass_SubCodeName)))
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('抱歉!添加失败!代码编号必须为1-50个字符(可以包含英文、数字和下划线)!');", true);
                return;
            }
            if (sysCodeDetailContext == "")
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c2", "OpenAlert('抱歉!添加失败!代码内容必须为1-50个字符!');", true);
                return;
            }
            BLL.SysCodeDetail scd = new BLL.SysCodeDetail();
            if (scd.Exists(sysCodeDetailID))
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c2", "OpenAlert('抱歉!添加失败!代码编号已存在!');", true);
                return;
            }
            Model.SysCodeDetail scdModel = new Model.SysCodeDetail();
            scdModel.SYSCodeID = sysCodeId;
            scdModel.SYSCodeDetialID = sysCodeDetailID;
            scdModel.SYSCodeDetialContext = sysCodeDetailContext;
            scdModel.Memo = memo;
            scdModel.LastModifyTime = DateTime.Now;
            scdModel.IsValid = isValid;
            bool isSubAdd = false;
            Model.Log logModel = new Model.Log();
            try
            {
                logModel.OperationItem = "添加子类";
                logModel.Operator = user.UserInfo.UserID;
                logModel.OperationTime = DateTime.Now;
                logModel.OperationDetail = "大类编号:" + sysCodeId + " - 子类编号:" + sysCodeDetailID + " - 子类内容:" + sysCodeDetailContext;

                isSubAdd = scd.Add(scdModel);
                if (isSubAdd)
                {
                    logModel.Memo = "成功";
                }
                else
                {
                    logModel.Memo = "失败!";
                }
            }
            catch (Exception ex)
            {
                logModel.Memo = "异常:" + ex.Message;
            }
            finally
            {
                log.Add(logModel);
                if (isSubAdd)
                {
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c3", "OpenAlert('恭喜!添加成功!');", true);
                }
                else
                {
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c4", "OpenAlert('抱歉!添加失败!');", true);
                }
            }
        }
Ejemplo n.º 37
0
        protected void rbtnSubmit_Click(object sender, EventArgs e)
        {
            string title = RTB_Title.Text;
            if (title.Trim().Equals(""))
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('抱歉,标题不能为空!');", true);
                return;
            }
            SmartLaw.Model.Questionary qnModel = new Model.Questionary();
            List<SmartLaw.Model.Question> qsModelList = new List<Model.Question>();
            if (!RadButton2.Checked)
            {
                qnModel.IsValid = true;
                for (int i = 0; i < RadGrid1.Items.Count; i++)
                {
                    SmartLaw.Model.Question qsM = new Model.Question();
                    qsM.Orders = i;
                    RadTextBox box = (RadTextBox)RadGrid1.Items[i].FindControl("content");
                    string Content = box.Text;
                    if (Content.Trim() == "")
                    {
                        RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('抱歉,问题不能为空!');", true);
                        return;
                    }
                    qsM.Content = Content;
                    RadTextBox box1 = (RadTextBox)RadGrid1.Items[i].FindControl("answer1");
                    string Answer1 = box1.Text;
                    RadTextBox box2 = (RadTextBox)RadGrid1.Items[i].FindControl("answer2");
                    string Answer2 = box2.Text;
                    RadTextBox box3 = (RadTextBox)RadGrid1.Items[i].FindControl("answer3");
                    string Answer3 = box3.Text;
                    RadTextBox box4 = (RadTextBox)RadGrid1.Items[i].FindControl("answer4");
                    string Answer4 = box4.Text;
                    StringBuilder ansSb = new StringBuilder();
                    if (Answer1.Trim() != "")
                    {
                        ansSb.Append(Answer1.Trim() + "|");
                    }
                    if (Answer2.Trim() != "")
                    {
                        ansSb.Append(Answer2.Trim() + "|");
                    }
                    if (Answer3.Trim() != "")
                    {
                        ansSb.Append(Answer3.Trim() + "|");
                    }
                    if (Answer4.Trim() != "")
                    {
                        ansSb.Append(Answer4.Trim() + "|");
                    }
                    if (ansSb.ToString().Equals(""))
                    {
                        RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('抱歉,一个问题至少有一个选项!');", true);
                        return;
                    }
                    string[] ans = ansSb.ToString().Substring(0, ansSb.ToString().Length - 1).Split('|');
                    qsM.Answer = ans;
                    RadButton rbt = RadGrid1.Items[i].FindControl("RadButton3") as RadButton;
                    qsM.IsSingle = rbt.Checked;
                    qsModelList.Add(qsM);
                }
            }
            else
            {
                qnModel.IsValid = false;
            }
            SmartLaw.Model.Log logM = new Model.Log();
            logM.OperationItem = "新增调查问卷";
            logM.OperationDetail = "标题:"+title;
            logM.OperationTime = DateTime.Now;
            logM.Operator = user.UserInfo.UserID;
            logM.Memo = "";
            long idAdd = 0;
            try
            {
                qnModel.Title = title;

                if (qnModel.IsValid)
                {
                    idAdd = qn.AddQuestionary(qnModel, qsModelList.ToArray());
                }
                else
                {
                    idAdd = qn.AddEmptyQuestionary(qnModel);
                }
                if (idAdd != 0)
                {
                    logM.Memo += "成功";
                }
                else
                {
                    logM.Memo += "失败";
                }
            }
            catch (Exception ex)
            {
                logM.Memo += ex.Message;
            }
            finally
            {
                log.Add(logM);
                if (idAdd!=0)
                {
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c", "OpenAlert('恭喜!添加成功!');", true);
                }
                else
                {
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c3", "OpenAlert('抱歉!添加失败!');", true);
                }
            }
        }
Ejemplo n.º 38
0
 /// <summary>
 /// 添加日志
 /// </summary>
 /// <param name="log"></param>
 private static void AddLog(Model.Log log)
 {
     log.Type = GetLogType(log.Type, Config.Language_Default);
     new Data.Log().Add(log);
 }
Ejemplo n.º 39
0
        protected void BtnOk_Click(object sender, EventArgs e)
        {
            string epc =  HiddenField1.Value.Trim();
            if (string.IsNullOrEmpty(epc))
            {
                WriteMessage("当前EPC信息无效", false);
            }

            Model.Task task = TaskBll.GetTaskByEpc(epc,true,true);
            if (task==null)
            {
                WriteMessage("当前EPC信息无效", false);
            }

            bool flag = false;
            if (task.Status==Model.TaskState.Ordering)
            {
                //在当前订单上追加订单
                Model.Order lastOrder = task.Orders.OrderBy(m=>m.Id).LastOrDefault();
                if (lastOrder==null)
                {
                     WriteMessage("无法追加订单", false);
                }

                bool change = false;
                int n = Util.DataConverter.ToLng(tbAddNum.Text);
                change = n > 0 || date2.SelectedDate.HasValue;

                if (change)
                {
                    lastOrder.Num += n;
                    if (date2.SelectedDate.HasValue)
                    {
                        lastOrder.Time = date2.SelectedDate.Value;
                    }
                    Model.Log stocklog = new Model.Log();
                    stocklog.Action = Model.LogAction.Order;
                    stocklog.AddTime = DateTime.Now;
                    stocklog.RangeBegin = DateTime.Now;
                    stocklog.StartUserName = RequestContext.Current.User.UserName;
                    stocklog.Title = "追加任务订单(编码:" + task.Code + ")";
                    stocklog.Description=(n>0?("数量增加"+n.ToString()):"")+" "+(date2.SelectedDate.HasValue?("日期调整至"+date2.Text):"");
                    stocklog.Type = Model.LogType.Normal;
                    task.Logs.Add(stocklog);

                }
                else
                {
                    WriteMessage("当前没有进行任何操作", true);
                }

            }
            else
            {
                Model.Order order = new Model.Order();
                order.AddTime = DateTime.Now;
                order.Description = tbDescription.Text;
                order.Num = Util.DataConverter.ToLng(tbNum.Text);
                order.Time = date1.SelectedDate.HasValue?date1.SelectedDate.Value:DateTime.Now;
                order.UserName = RequestContext.Current.User.UserName;
                task.Orders.Add(order);
                task.Status = Model.TaskState.WaitOrderConfirm;

                Model.Log stocklog = new Model.Log();
                stocklog.Action = Model.LogAction.Order;
                stocklog.AddTime = DateTime.Now;
                stocklog.RangeBegin = DateTime.Now;
                stocklog.StartUserName = RequestContext.Current.User.UserName;
                stocklog.Title = "增加任务订单(编码:" + task.Code + ")";
                stocklog.Type = Model.LogType.Normal;
                task.Logs.Add(stocklog);

            }
            flag = TaskBll.UpdateTask(task);

            WriteMessage(flag ? "操作成功" : "操作失败", flag);
        }
Ejemplo n.º 40
0
        /// <summary>
        /// Método para recuperar dados do registro e fazer interação com banco
        /// </summary>
        private void EditSupplier()
        {
            //Verificando se campos estão preenchidos
            if (IsValidFields())
            {
                string cnpj = cnpjEdit.Text.Replace(".", "").Replace("-", "").Replace("_", ".").Replace("/", "");
                string cep  = cepEdit.Text.Replace("-", "").Replace("_", "");
                if (Validator.IsCnpj(cnpj))    //Validando documentos
                {
                    try {
                        //Recuperando dados do funcionário
                        ComboBoxItem selected = cbState.Items[cbState.SelectedIndex] as ComboBoxItem;
                        aux.adress.street       = AdressEdit.Text;
                        aux.adress.city         = CityEdit.Text;
                        aux.adress.neighborhood = NeighboorhoodEdit.Text;
                        aux.adress.number       = NumberEdit.Text;
                        aux.adress.UF           = selected.Content.ToString();
                        aux.adress.CEP          = cep;
                        aux.name      = NameEdit.Text;
                        aux.cnpj      = cnpj;
                        aux.cellPhone = phone2Edit.Text;
                        aux.resPhone  = phone1Edit.Text;
                        if (cbActive.SelectedIndex == 1)
                        {
                            aux.Inactivate();
                        }
                        else
                        {
                            aux.Activate();
                        }

                        //Alterando registro no banco
                        dao.EditSupplier(aux);

                        //Registrando log de alteração
                        Model.Log edited = new Model.Log();
                        edited.employe = _employe;
                        edited.action  = $"Fornecedor {aux.name} com ID = {aux.id} sofreu alteração no sistema!";
                        logs.Register(edited);

                        //Atualizando grid e limpando campos de texto
                        RefreshGrid();
                        ClearFields();
                        BlockFields();
                        actionIndex = -1;
                        aux         = null;
                    }
                    catch (DatabaseEditException err) {
                        //Retornando mensagem de erro para usuário
                        MessageBox.Show(
                            err.Message,
                            "Erro ao gravar dados",
                            MessageBoxButton.OK,
                            MessageBoxImage.Error);
                    }
                }
                else
                {
                    //Retornando mensagem de validação
                    MessageBox.Show(
                        "CNPJ Inválido(s)",
                        "Dados incorretos!",
                        MessageBoxButton.OK,
                        MessageBoxImage.Warning
                        );
                }
            }
            else
            {
                //Mostrando alerta de validação
                MessageBox.Show(
                    "Há Campos Vazios",
                    "Erro de Prenchimento de Formulário",
                    MessageBoxButton.OK,
                    MessageBoxImage.Warning
                    );
            }
        }
Ejemplo n.º 41
0
        private void ValidatePwd()
        {
            HttpCookie cookie = Request.Cookies["Login"];
            if (cookie == null)
                return;
            string loginId = cookie.Values["loginId"];
            string password;
            try
            {
                string psw = cookie.Values["pwd"].Replace(' ', '+');
                password = Encoding.UTF8.GetString(Convert.FromBase64String(psw));
            }
            catch
            {
                return;
            }

            SessionUser user = new SessionUser();
            user.SetSession(loginId, password, Session);
            if (SessionUser.IsLogined())
            {
                string skinValue = "Windows7";
                Session["SkinId"] = skinValue;
                Model.Log logM = new Model.Log();
                logM.OperationItem = "操作员登录";
                logM.Operator = loginId;
                logM.OperationTime = DateTime.Now;
                logM .OperationDetail = "ip:【" + Request.UserHostAddress + "】";
                _log.Add(logM);
                if (Request.QueryString["returnurl"] == null)
                    Response.Redirect("NewsManage/NewsList.aspx");
                else
                    Response.Redirect(HttpUtility.UrlDecode(Request.QueryString["returnurl"].ToString()));
            }
            TB_LoginId.Text = loginId;
        }
Ejemplo n.º 42
0
        /// <summary>
        /// Método para editar funcionário via GUI
        /// </summary>
        private void EditEmploye()
        {
            //Verificando se campos estão preenchidos
            if (IsValidFields())
            {
                string cpf = cpfEdit.Text.Replace(".", "").Replace("-", "").Replace("_", ".");
                string cep = cepEdit.Text.Replace("-", "").Replace("_", "");
                if (Validator.IsCpf(cpf))    //Validando documentos
                {
                    try {
                        //Recuperando dados do funcionário
                        ComboBoxItem selected = cbState.Items[cbState.SelectedIndex] as ComboBoxItem;
                        aux.adress.street       = AdressEdit.Text;
                        aux.adress.city         = CityEdit.Text;
                        aux.adress.neighborhood = NeighboorhoodEdit.Text;
                        aux.adress.number       = NumberEdit.Text;
                        aux.adress.UF           = selected.Content.ToString();
                        aux.adress.CEP          = cep;
                        aux.name      = NameEdit.Text;
                        aux.cpf       = cpf;
                        aux.admission = admissionEdit.Text;
                        aux.job       = RoleEdit.Text;
                        if (cbActive.SelectedIndex == 1)
                        {
                            aux.Inactivate();
                        }
                        else
                        {
                            aux.Activate();
                        }
                        if (cbHasUser.SelectedIndex == 2)
                        {
                            aux.role = "none";
                            aux.user = null;
                        }
                        else
                        {
                            if (cbHasUser.SelectedIndex == 1)
                            {
                                aux.role = "User";
                            }
                            else
                            {
                                aux.role = "Admin";
                            }
                            aux.user = new User(usernameEdit.Text, passwordEdit.Password);
                        }

                        //Alterando registro no banco
                        dao.EditEmploye(aux);

                        //Registrando log de alteração
                        Model.Log edited = new Model.Log();
                        edited.employe = _employe;
                        edited.action  = "Funcionário {aux.name} com ID = {aux.id} sofreu alteração no sistema!";
                        logs.Register(edited);

                        //Atualizando grid e limpando campos de texto
                        RefreshGrid();
                        ClearFields();
                        BlockFields();
                        actionIndex = -1;
                        aux         = null;
                    }
                    catch (DatabaseEditException err) {
                        //Retornando mensagem de erro para usuário
                        MessageBox.Show(
                            err.Message,
                            "Erro ao gravar dados",
                            MessageBoxButton.OK,
                            MessageBoxImage.Error);
                    }
                }
                else
                {
                    //Retornando mensagem de validação
                    MessageBox.Show(
                        "CPF ou RG Inválido(s)",
                        "Dados incorretos!",
                        MessageBoxButton.OK,
                        MessageBoxImage.Warning
                        );
                }
            }
            else
            {
                //Mostrando alerta de validação
                MessageBox.Show(
                    "Há Campos Vazios",
                    "Erro de Prenchimento de Formulário",
                    MessageBoxButton.OK,
                    MessageBoxImage.Warning
                    );
            }
        }
Ejemplo n.º 43
0
 protected void RadButton1_Click(object sender, EventArgs e)
 {
     int selectCount = RGrid_NewsList.SelectedItems.Count;
     if (selectCount == 0)
     {
         RadScriptManager.RegisterStartupScript(Page, GetType(), "c3", "OpenAlert('抱歉!您未选择任何条目!!');", true);
         return;
     }
     if (!RadButton2.SelectedToggleState.Selected && !RadButton3.SelectedToggleState.Selected)
     {
         RadScriptManager.RegisterStartupScript(Page, GetType(), "c3", "OpenAlert('抱歉!您未选择审核状态(结果)!!');", true);
         return;
     }
     Model.Log logModel = new Model.Log();
     logModel.OperationItem = "审核条目";
     logModel.Operator = user.UserInfo.UserID;
     logModel.OperationTime = DateTime.Now;
     int totCount = selectCount;
     int sucCount = 0;
     int errCount = 0;
     StringBuilder notExist = new StringBuilder("");
     try
     {
         StringBuilder sb = new StringBuilder("【");
         StringBuilder sb2 = new StringBuilder("【");
         int checkIf = 0;
         if (RadButton2.SelectedToggleState.Selected)
         {
             checkIf = 1;
             foreach (GridDataItem item in RGrid_NewsList.MasterTableView.Items)
             {
                 if ((item["CheckboxSelectColumn"].Controls[0] as CheckBox).Checked)
                 {
                     String newsid = item["AutoID"].Text;
                     sb.Append(newsid + " ");
                     if (!news.Exists(long.Parse(newsid)))
                     {
                         errCount++;
                         notExist.Append(newsid+ " ");
                         continue;
                     }
                     Model.News newsModel = news.GetModel(long.Parse(newsid));
                     newsModel.Checked = 1;
                     newsModel.Checker = user.UserInfo.UserID;
                     newsModel.CheckMemo = "";
                     bool isUpdate = false;
                     isUpdate = news.Update(newsModel);
                     if (isUpdate)
                     {
                         sucCount++;
                         sb2.Append(newsid + " ");
                     }
                 }
             }
         }
         else if (RadButton3.SelectedToggleState.Selected)
         {
             foreach (GridDataItem item in RGrid_NewsList.MasterTableView.Items)
             {
                 if ((item["CheckboxSelectColumn"].Controls[0] as CheckBox).Checked)
                 {
                     String newsid = item["AutoID"].Text;
                     sb.Append(newsid + " ");
                     if (!news.Exists(long.Parse(newsid)))
                     {
                         errCount++;
                         notExist.Append(newsid + " ");
                         continue;
                     }
                     Model.News newsModel = news.GetModel(long.Parse(newsid));
                     newsModel.Checked = 2;
                     newsModel.Checker = user.UserInfo.UserID;
                     newsModel.CheckMemo = TB_CheckMemo.Text;
                     bool isUpdate = false;
                     isUpdate = news.Update(newsModel);
                     if (isUpdate)
                     {
                         sucCount++;
                         sb2.Append(newsid + " ");
                     }
                 }
             }
         }
         sb.Append("】");
         sb2.Append("】");
         logModel.OperationDetail = "条目审核提交列表[" + totCount + "]:" + sb.ToString() + "审核成功列表[" + sucCount + "]:" + sb2.ToString() + " - 审核状态:" + checkIf + " - 审核备注:" + TB_CheckMemo.Text;
     }
     catch (Exception ex)
     {
         logModel.Memo = "异常:" + ex.Message;
     }
     finally
     {
         if (totCount == (sucCount + errCount) && totCount > 0)
         {
             logModel.Memo = "成功";
             ReadValue();
             if (errCount == 0)
             {
                 RadScriptManager.RegisterStartupScript(Page, GetType(), "c2", "OpenAlert('恭喜!审核条目成功!');", true);
             }
             else
             {
                 RadScriptManager.RegisterStartupScript(Page, GetType(), "c2", "OpenAlert('恭喜!审核条目成功!但是条目【"+notExist.ToString()+"】已不存在,未更新审核信息。');", true);
             }
         }
         else
         {
             logModel.Memo = "失败";
             RadScriptManager.RegisterStartupScript(Page, GetType(), "c3", "OpenAlert('抱歉!有条目修改失败!');", true);
         }
         log.Add(logModel);
     }
 }
Ejemplo n.º 44
0
        protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            GridDataItem dataItem = null;

            if (e.Item is GridDataItem)
            {
                dataItem = e.Item as GridDataItem;

                int selectedRowIndex = dataItem.RowIndex;
            }



            if (e.CommandName == "PO_PDF")


            {
                string filename = e.CommandArgument.ToString();
                if (filename != "")
                {
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();

                    L.content   = "View PO " + filename + ".pdf";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);
                    string path = MapPath("PO_Pdf/" + filename + ".pdf");

                    //if (!File.Exists(path))
                    //{
                    //    Response.Write("<script>alert('ไฟล์นี้ยังไม่ได้ถูก Sign prepare.');</script>");
                    //    return;
                    //}

                    byte[] bts = System.IO.File.ReadAllBytes(path);
                    Response.Clear();
                    Response.ClearHeaders();
                    Response.AddHeader("Content-Type", "Application/octet-stream");
                    Response.AddHeader("Content-Length", bts.Length.ToString());
                    Response.AddHeader("Content-Disposition", "attachment;   filename=" + filename + ".pdf");
                    Response.BinaryWrite(bts);
                    Response.Flush();
                    Response.End();
                }
            }


            if (e.CommandName == "PDF_Approve")
            {
                string filename = e.CommandArgument.ToString();
                if (filename != "")
                {
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();

                    L.content   = "View PR Approve " + filename + ".pdf";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);
                    string path = MapPath("PdfApprove/" + filename + ".pdf");

                    //if (!File.Exists(path))
                    //{
                    //    Response.Write("<script>alert('ไฟล์นี้ยังไม่ได้ถูก Sign prepare.');</script>");
                    //    return;
                    //}

                    byte[] bts = System.IO.File.ReadAllBytes(path);
                    Response.Clear();
                    Response.ClearHeaders();
                    Response.AddHeader("Content-Type", "Application/octet-stream");
                    Response.AddHeader("Content-Length", bts.Length.ToString());
                    Response.AddHeader("Content-Disposition", "attachment;   filename=" + filename + ".pdf");
                    Response.BinaryWrite(bts);
                    Response.Flush();
                    Response.End();
                }
            }



            if (e.CommandName == "PO_PDF_APPROVE")
            {
                string filename = e.CommandArgument.ToString();
                try
                {
                    if (filename != "")
                    {
                        Model.Log      L   = new Model.Log();
                        Helper.Utility Log = new Helper.Utility();

                        L.content   = "View PO Approve " + filename + ".pdf";
                        L.create_by = Session["EMAIL"].ToString();
                        Log.WriteLog(L);
                        string path = MapPath("PO_PdfApprove/" + filename + ".pdf");

                        //if (!File.Exists(path))
                        //{
                        //    Response.Write("<script>alert('ไฟล์นี้ยังไม่ได้ถูก Sign prepare.');</script>");
                        //    return;
                        //}

                        byte[] bts = System.IO.File.ReadAllBytes(path);
                        Response.Clear();
                        Response.ClearHeaders();
                        Response.AddHeader("Content-Type", "Application/octet-stream");
                        Response.AddHeader("Content-Length", bts.Length.ToString());
                        Response.AddHeader("Content-Disposition", "attachment;   filename=" + filename + ".pdf");
                        Response.BinaryWrite(bts);
                        Response.Flush();
                        Response.End();
                    }
                }
                catch (FileNotFoundException Exception)
                {
                }
            }



            // Attath file
            if (e.CommandName == "cmd")
            {
                string filename = e.CommandArgument.ToString();
                if (filename != "")
                {
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();

                    L.content   = "Download attach file name " + filename + ".zip";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);
                    string path = MapPath("PO_AttachFiles/" + filename + ".zip");
                    byte[] bts  = System.IO.File.ReadAllBytes(path);
                    Response.Clear();
                    Response.ClearHeaders();
                    Response.AddHeader("Content-Type", "Application/octet-stream");
                    Response.AddHeader("Content-Length", bts.Length.ToString());
                    Response.AddHeader("Content-Disposition", "attachment;   filename=" + filename + ".zip");
                    Response.BinaryWrite(bts);
                    Response.Flush();
                    Response.End();
                }
            }

            if (e.CommandName == "step2")
            {
                int idx = Convert.ToInt32(e.CommandArgument);


                if (Session["LEVEL"].ToString() != "2")
                {
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "[Access denied!] Go to sendMailRequest.aspx.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);

                    Response.Write("<script>alert('คุณไม่มีสิทธิ์ส่งเมล์เพื่อ Request.');</script>");
                }



                else if (e.CommandArgument.ToString() == "1")
                {
                    Response.Write("<script>alert('คุณไม่สามารถส่งเมล์ได้เนื่องจากส่งไปแล้ว');</script>");
                }


                else
                {
                    string doc_id;
                    string email;
                    string content;

                    doc_id  = dataItem.Cells[2].Text;
                    email   = Session["EMAIL"].ToString();
                    content = dataItem.Cells[4].Text;

                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "Go PO_SendMailRequest.aspx.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);
                    Response.Redirect("PO_SendMailRequest.aspx?doc_id=" + doc_id + "&email=" + email + "&content=" + content);
                }
            }


            if (e.CommandName == "step3")
            {
                int idx = Convert.ToInt32(e.CommandArgument);
                if (Session["LEVEL"].ToString() != "2")
                {
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "[Access denied!] Go to sendMailReview.aspx.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);

                    Response.Write("<script>alert('คุณไม่มีสิทธิ์ส่งเมล์เพื่อ Review.');</script>");
                }

                //else if (  e.CommandArgument.ToString() == "1")
                //{
                //    Response.Write("<script>alert('คุณไม่สามารถส่งเมล์ได้เนื่องจากส่งไปแล้ว');</script>");
                //}

                else
                {
                    string doc_id;
                    string email;
                    string content;

                    doc_id  = dataItem.Cells[2].Text;
                    email   = Session["EMAIL"].ToString();
                    content = dataItem.Cells[4].Text;

                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "Go to PO_SendMailReview.aspx.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);
                    Response.Redirect("PO_SendMailReview.aspx?doc_id=" + doc_id + "&email=" + email + "&content=" + content);
                }
            }

            if (e.CommandName == "step4")
            {
                int idx = Convert.ToInt32(e.CommandArgument);
                if (Session["LEVEL"].ToString() != "2")
                {
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "[Access denied!] Go to sendMailReview.aspx.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);

                    Response.Write("<script>alert('คุณไม่มีสิทธิ์ส่งเมล์เพื่อ Review.');</script>");
                }

                //else if (  e.CommandArgument.ToString() == "1")
                //{
                //    Response.Write("<script>alert('คุณไม่สามารถส่งเมล์ได้เนื่องจากส่งไปแล้ว');</script>");
                //}

                else
                {
                    string doc_id;
                    string email;
                    string content;

                    doc_id  = dataItem.Cells[2].Text;
                    email   = Session["EMAIL"].ToString();
                    content = dataItem.Cells[4].Text;

                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "Go to PO_SendMailApprove.aspx.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);
                    Response.Redirect("PO_SendMailApprove.aspx?doc_id=" + doc_id + "&email=" + email + "&content=" + content);
                }
            }
        }
        protected void btnCommit_Click(object sender, EventArgs e)
        {
            Model.Log log = new Model.Log();

            int meetingApplyFormID = int.Parse(this.hfdMeetingApplyFormID.Value);
            Model.Meeting meeting = BusinessLogic.Meeting.GetApplyMeetingInfoByMeeingID(meetingApplyFormID);
            meeting.MeetingApplyFormID = meetingApplyFormID;
            meeting.WFID = BusinessLogic.Meeting.GetGuidByApplyForm(meetingApplyFormID);
            if (rbtAgree.Checked)
            {

                //同意
                meeting.MeetingStatus = 4;
                //todo  发送邮件给与会者
                MailModel mailModel = new MailModel();
                Model.Meeting me = BusinessLogic.Meeting.GetApplyMeetingInfoByMeeingID(meetingApplyFormID);
                List<Model.UserInfo> UserEmailAndName = BusinessLogic.MeetingUser.GetUserEmailAndNameByMeetingApplyFormID(meetingApplyFormID);
                #region E-Mail Body
                System.Text.StringBuilder sbMailBody = new System.Text.StringBuilder();
                sbMailBody.Append("您好!");
                sbMailBody.Append("");
                sbMailBody.Append("邀请您参加");
                sbMailBody.Append(meeting.BeginTime);
                sbMailBody.Append("到");
                sbMailBody.Append(meeting.EndTime);
                sbMailBody.Append(",在");
                sbMailBody.Append(BusinessLogic.MeetingRoom.GetMeetingRoomNameByMeetingApplyFormID(meetingApplyFormID));
                sbMailBody.Append("召开的会议。谢谢!如有事情耽搁,请与");
                sbMailBody.Append(BusinessLogic.MeetingUser.GetUserEmailAndNameByMeetingApplyFormID(meetingApplyFormID).ToArray()[0].UserEmail);
                sbMailBody.Append("这个Email联系。");
                #endregion
                mailModel.MailFrom = ConfigurationManager.AppSettings["commomEmail"].ToString();
                mailModel.Password = ConfigurationManager.AppSettings["emailPassword"].ToString();
                mailModel.SmtpServer = ConfigurationManager.AppSettings["smtpServer"].ToString();
                mailModel.SmtpPort = int.Parse(ConfigurationManager.AppSettings["port"].ToString());
                mailModel.DisplayName = "会议邀请";
                mailModel.MailBcc = null;
                mailModel.MailCc = null;
                mailModel.MailSubject = meeting.MeetingTopic;
                mailModel.MailBody = sbMailBody.ToString();
                mailModel.MailTo = null;//此处留空,在SendEmail里才会赋值
                mailModel.SmtpPort = 25;
                mailModel.SmtpSsl = false;
                mailModel.UserName = ConfigurationManager.AppSettings["userName"].ToString();
                try
                {
                    SendEmail.SendEmailTo(UserEmailAndName, mailModel);
                    lblMessage.Text = "会议设备安排成功!";
                }
                catch (YunShanOA.Common.SendMailFailExecpion sendMailFail)
                {
                    log = new Model.Log();
                    log.LogContext = sendMailFail.Message;
                    log.LogTime = System.DateTime.Now;
                    log.userName = Page.User.Identity.Name;
                    log.LogTypeID = "1";
                    BusinessLogic.Log.SaveLog(log);
                    lblMessage.Text = "发送邮件出现异常,请联系申请人重新申请!申请人Email:"+BusinessLogic.MeetingUser.GetUserEmailByUserName(log.userName);
                }

            }
            else
            {
                //不同意
                meeting.MeetingStatus = 3;
                Dictionary<int, int> meetingIDAndName = BusinessLogic.MeetingEquipment.GetMeetingEquipmentIDAndCount(meetingApplyFormID);
                foreach (var m in meetingIDAndName)
                {
                    BusinessLogic.MeetingEquipment.ReturnEquipmentCount(m.Key, m.Value);
                }
            }
            //todo 更新MeetingAndRoom里的状态,有待测试
            lblMessage.Text = "会议设备处理成功";
            //更新MeetingAndRoom表里的状态
            BusinessLogic.MeetingRoom.UpdateMeetingAndRoomStatus(meetingApplyFormID, meeting.MeetingStatus);
            BusinessLogic.Meeting.UpdateMeetingApplyFormStatus(meetingApplyFormID, meeting.MeetingStatus);
            Server.Transfer("~/OfficeAdmin/ProcessMeetingEquipmentArr.aspx");
        }
Ejemplo n.º 46
0
        protected void Bt_Add_Click(object sender, EventArgs e)
        {
            string loginName = TB_LoginName.Text.Trim();
            string password = TB_Password.Text.Trim();
            string pwdCheck = TB_PwdCheck.Text.Trim();
            string userName = TB_UserName.Text.Trim();
            string employeeID = TB_EmployeeID.Text.Trim();
            string matchPass_LoginName = @"^[a-z0-9A-Z_-]{1,20}$";
            string matchPass_Password = @"^[a-z0-9A-Z_-]{7,20}$";

            if (loginName == "" || !(Regex.IsMatch(loginName, matchPass_LoginName)))
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('登录名必须为1-10个字符(可以包含英文、数字和下划线)!');", true);
                return;
            }
            if (password == "" || !(Regex.IsMatch(password, matchPass_Password)))
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c2", "OpenAlert('密码必须为7-20个字符(可以包含英文、数字和下划线)!');", true);
                return;
            }
            if (password != pwdCheck)
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c3", "OpenAlert('两次密码输入不一致!');", true);
                return;
            }
            if (userName == "")
            {
                RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c4", "OpenAlert('姓名必须为1-50个字符!');", true);
                return;
            }
            string roleId = RCB_Role.SelectedValue;
            bool enable = RCB_Enable.SelectedItem.Value == "1" ? true : false;

            Model.SysUser suModel = new Model.SysUser();
            suModel.UserID = loginName;
            suModel.Password = password;
            suModel.UserName = userName;
            suModel.EmployeeID = employeeID;
            suModel.IsValid = enable;
            SysUser su = new SysUser();
            bool isAdd = false;
            long scrAdd = 0;
            Model.Log logModel = new Model.Log();
            try
            {
                logModel.OperationItem = "添加用户";
                logModel.Operator = user.UserInfo.UserID;
                logModel.OperationTime = DateTime.Now;
                logModel.OperationDetail = "登录名:" + loginName + " - 用户名:" + userName + " - 角色:" + RCB_Role.SelectedItem.Text;
                isAdd = su.Add(suModel);
                Model.SysCodeRelation scrModel = new Model.SysCodeRelation();
                if (isAdd)
                {
                    scrModel.SysCodeDetialID = loginName;
                    scrModel.SysCodeDetialIDEx = roleId;
                    scrAdd = scr.Add(scrModel);
                }

                if (isAdd && scrAdd!=0)
                {
                    logModel.Memo = "成功";
                }
                else if (!isAdd)
                {
                    logModel.Memo = "失败!";
                }
                else
                {
                    logModel.Memo = "角色设置失败!";
                }
            }
            catch (Exception ex)
            {
                logModel.Memo = "异常:" + ex.Message;
            }
            finally
            {
                log.Add(logModel);
                if (isAdd && scrAdd!=0)
                {
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c5", "OpenAlert('恭喜!操作员\"" + loginName + "\"添加成功!');", true);
                }
                else if (!isAdd)
                {
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c6", "OpenAlert('抱歉!操作员\"" + loginName + "\"添加失败!');", true);

                }
                else
                {
                    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c6", "OpenAlert('操作员\"" + loginName + "\"添加成功!但是角色设置失败,请到系统代码中重新关联该用户角色!!');", true);

                }
            }
        }
Ejemplo n.º 47
0
 protected void SubmitBtn_Click(object sender, EventArgs e)
 {
     if (RCB_Identity.CheckedItems.Count == 0)
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('身份选择不能为空!');", true);
         return;
     }
     RadTreeView regionTreeView = RadDropDownTree1.Controls[0] as RadTreeView;
     if (regionTreeView.SelectedNodes.Count==0)
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('区域选择不能为空!');", true);
         return;
     }
     if (RTB_Name.Text.Trim().Equals(""))
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('用户姓名不能为空!');", true);
         return;
     }
     if (RTB_SIM.Text.Trim().Equals(""))
     {
         RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c1", "OpenAlert('STB号不能为空!');", true);
         return;
     }
     Model.Log logModel = new Model.Log();
     logModel.OperationItem = "添加终端用户";
     logModel.OperationTime = DateTime.Now;
     logModel.Operator = user.UserInfo.UserID;
     logModel.Memo = "";
     Model.EndUser euModel = new Model.EndUser();
     euModel.EndUserName = RTB_Name.Text;
     euModel.SimCardNo = RTB_SIM.Text;
     euModel.LastModifyTime = DateTime.Now;
     euModel.IsValid = true;
     StringBuilder sb = new StringBuilder();
     foreach (RadComboBoxItem rcbi in RCB_Identity.CheckedItems)
     {
         sb.Append("|"+rcbi.Value + "|");
     }
     sb.Append("|" + regionTreeView.SelectedValue + "|");
     string identityStr = sb.ToString();
     logModel.OperationDetail = "姓名:"+RTB_Name.Text+"SIM:"+RTB_SIM.Text+"身份&区域:"+identityStr;
     euModel.Identities = identityStr;
     long autoid = 0;
     try
     {
         autoid = eu.Add(euModel);
         if (autoid > 0)
         {
             using (MongoDBServiceSoapClient mg = new MongoDBServiceSoapClient())
             {
                 MongoDBService.EndUser dc = new MongoDBService.EndUser();
                 bool IsAddMg = true;
                 string rtStr = "";
                 if (mg.SelectEnduserBySimCardNo(euModel.SimCardNo, out rtStr) == null)
                 {
                     IsAddMg = false;
                     dc.AutoID = autoid.ToString();
                     dc.EnduserName = euModel.EndUserName;
                     string[] identityArr = euModel.Identities.Split('|');
                     ArrayOfString aof = new ArrayOfString();
                     foreach (string id in identityArr)
                     {
                         if (id.Trim().Equals(""))
                         {
                             continue;
                         }
                         aof.Add(id);
                     }
                     dc.Identities = aof;
                     dc.IsValid = true;
                     dc.LastModifyTime = euModel.LastModifyTime;
                     dc.SimCardNo = euModel.SimCardNo;
                     IsAddMg = mg.InsertEnduser(dc, out rtStr);
                 }
                 if (!IsAddMg)
                 {
                     eu.Delete(autoid);
                     autoid = 0;
                 }
                 logModel.Memo += rtStr;
             }
         }
     }
     catch (Exception ex)
     {
         autoid = 0;
         logModel.Memo += ex.Message;
     }
     finally
     {
         log.Add(logModel);
         if (autoid > 0)
         {
             RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c", "OpenAlert('恭喜!用户添加成功!');", true);
         }
         else
         {
             RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c", "OpenAlert('抱歉!用户添加失败!');", true);
         }
     }
 }
Ejemplo n.º 48
0
        protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "step2")
            {
                DataTable _dt;
                _dt = (DataTable)Session["DT"];
                int         index       = Convert.ToInt32(e.CommandArgument);
                GridViewRow selectedRow = grid.Rows[index];

                if (selectedRow.Cells[4].Text != Session["EMAIL"].ToString())
                {
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "[Access denied!] Go to FrmApplicationPrepare.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);

                    Response.Write("<script>alert('คุณไม่มีสิทธิ์ Sign prepare.');</script>");
                }

                else if (_dt.Rows[index]["step2"].ToString() == "1")
                {
                    Response.Write("<script>alert('คุณไม่สามารถ Sign prepare ได้เนื่องจาก Sign ไปแล้ว');</script>");
                }

                else
                {
                    string page_count = "";
                    string doc_id;
                    string signature;
                    string paper_type;

                    BLL.Upload _BLL = new BLL.Upload();

                    doc_id     = selectedRow.Cells[0].Text;
                    page_count = _BLL.get_Pagecount(doc_id);
                    paper_type = _BLL.Get_Paper_type(doc_id);
                    signature  = Session["SIGNATURE"].ToString();
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "Go to FrmApplicationPrepare.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);
                    Response.Redirect("FrmApplicationPrepare.aspx?doc_id=" + doc_id + "&signature=" + signature + "&page_count=" + page_count + "&paper_type=" + paper_type);
                }
            }

            // APPROVE CHECK SECURE_APPROVE
            if (e.CommandName == "step4")
            {
                DataTable _dt;
                _dt = (DataTable)Session["DT"];
                int         index       = Convert.ToInt32(e.CommandArgument);
                GridViewRow selectedRow = grid.Rows[index];
                if (selectedRow.Cells[14].Text != Session["EMAIL"].ToString())
                {
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "[Access denied!] Go to FrmApplicationApprove.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);

                    Response.Write("<script>alert('คุณไม่มีสิทธิ์ Sign Approve.');</script>");
                }


                else if (_dt.Rows[index]["step4"].ToString() == "1")
                {
                    Response.Write("<script>alert('คุณไม่สามารถ Sign approve ได้เนื่องจากได้ Sign ไปแล้ว');</script>");
                }

                else
                {
                    string doc_id;
                    string signature;
                    string page_count;
                    string paper_type;
                    doc_id = selectedRow.Cells[0].Text;

                    BLL.Upload _BLL = new BLL.Upload();
                    page_count = _BLL.get_Pagecount(doc_id);
                    paper_type = _BLL.Get_Paper_type(doc_id);

                    signature = Session["SIGNATURE"].ToString();
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "Go to FrmApplicationApprove.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);
                    Response.Redirect("FrmApplicationApprove.aspx?doc_id=" + doc_id + "&signature=" + signature + "&page_count=" + page_count + "&paper_type=" + paper_type);
                }
            }

            if (e.CommandName == "cmd")
            {
                string filename = e.CommandArgument.ToString();
                if (filename != "")
                {
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();

                    L.content   = "Download attach file name " + filename + ".zip";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);
                    string path = MapPath("AttachFiles/" + filename + ".zip");
                    byte[] bts  = System.IO.File.ReadAllBytes(path);
                    Response.Clear();
                    Response.ClearHeaders();
                    Response.AddHeader("Content-Type", "Application/octet-stream");
                    Response.AddHeader("Content-Length", bts.Length.ToString());
                    Response.AddHeader("Content-Disposition", "attachment;   filename=" + filename + ".zip");
                    Response.BinaryWrite(bts);
                    Response.Flush();
                    Response.End();
                }
            }


            if (e.CommandName == "PDF_APPROVE")
            {
                string filename = e.CommandArgument.ToString();
                if (filename != "")
                {
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();

                    L.content   = "View Approve " + filename + ".pdf";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);
                    string path = MapPath("PdfApprove/" + filename + ".pdf");


                    if (!File.Exists(path))
                    {
                        Response.Write("<script>alert('ไฟล์นี้ยังไม่ได้ถูก Sign approve.');</script>");
                        return;
                    }



                    byte[] bts = System.IO.File.ReadAllBytes(path);
                    Response.Clear();
                    Response.ClearHeaders();
                    Response.AddHeader("Content-Type", "Application/octet-stream");
                    Response.AddHeader("Content-Length", bts.Length.ToString());
                    Response.AddHeader("Content-Disposition", "attachment;   filename=" + filename + ".pdf");
                    Response.BinaryWrite(bts);
                    Response.Flush();
                    Response.End();
                }
            }


            if (e.CommandName == "PDF_PREPARE")
            {
                string filename = e.CommandArgument.ToString();
                if (filename != "")
                {
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();

                    L.content   = "View Prepare " + filename + ".pdf";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);
                    string path = MapPath("PdfPrepare/" + filename + ".pdf");

                    if (!File.Exists(path))
                    {
                        Response.Write("<script>alert('ไฟล์นี้ยังไม่ได้ถูก Sign prepare.');</script>");
                        return;
                    }

                    byte[] bts = System.IO.File.ReadAllBytes(path);
                    Response.Clear();
                    Response.ClearHeaders();
                    Response.AddHeader("Content-Type", "Application/octet-stream");
                    Response.AddHeader("Content-Length", bts.Length.ToString());
                    Response.AddHeader("Content-Disposition", "attachment;   filename=" + filename + ".pdf");
                    Response.BinaryWrite(bts);
                    Response.Flush();
                    Response.End();
                }
            }


            //if (e.CommandName == "DELETE")
            //{

            //      int index = Convert.ToInt32(e.CommandArgument);
            //    GridViewRow selectedRow = grid.Rows[index];
            //    if(selectedRow.Cells[5].Text != Session["EMAIL"].ToString())
            //    {
            //        Model.Log L = new Model.Log();
            //        Helper.Utility Log = new Helper.Utility();
            //        L.content = "[Access denied!] Delete " + selectedRow.Cells[0].Text;
            //        L.create_by = Session["EMAIL"].ToString();
            //        Log.WriteLog(L);

            //    }
            //    else
            //    {


            //            Model.Log L = new Model.Log();
            //            Helper.Utility Log = new Helper.Utility();


            //            Model.Criteria.Document criteria = new Model.Criteria.Document();
            //            criteria.doc_id = selectedRow.Cells[0].Text;
            //            BLL.Upload BL = new BLL.Upload();
            //            BL.Delete_Document(criteria);


            //            L.content = "Delete Documnet  " + selectedRow.Cells[0].Text;
            //            L.create_by = Session["EMAIL"].ToString();
            //            Log.WriteLog(L);
            //            BindGrid();
            //    }



            // }

            if (e.CommandName == "step3")


            {
                DataTable _dt;
                _dt = (DataTable)Session["DT"];
                int         idx = Convert.ToInt32(e.CommandArgument);
                GridViewRow Row = grid.Rows[idx];

                if (Row.Cells[4].Text != Session["EMAIL"].ToString())
                {
                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "[Access denied!] Go to sendMailApprove.aspx.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);

                    Response.Write("<script>alert('คุณไม่มีสิทธิ์ส่งเมล์เพื่อ Approve.');</script>");
                }


                else if (_dt.Rows[idx]["step2"].ToString() == "0")
                {
                    Response.Write("<script>alert('คุณไม่สามารถส่งเมล์ได้เนื่องจากเอกสารยังไม่ได้ Sign prepare.');</script>");
                }

                else if (_dt.Rows[idx]["step3"].ToString() == "1")
                {
                    Response.Write("<script>alert('คุณไม่สามารถส่งเมล์ได้เนื่องจากส่งไปแล้ว');</script>");
                }


                else
                {
                    string doc_id;
                    string email;
                    string content;

                    doc_id  = Row.Cells[0].Text;
                    email   = Session["EMAIL"].ToString();
                    content = Row.Cells[2].Text;

                    Model.Log      L   = new Model.Log();
                    Helper.Utility Log = new Helper.Utility();
                    L.content   = "Go to SendMailApprove.aspx.";
                    L.create_by = Session["EMAIL"].ToString();
                    Log.WriteLog(L);
                    Response.Redirect("SendMailApprove.aspx?doc_id=" + doc_id + "&email=" + email + "&content=" + content);
                }
            }
        }