protected void gvList_RowCommand1(object sender, GridViewCommandEventArgs e) { string cmdName = e.CommandName; int nodeId = int.Parse(e.CommandArgument.ToString()); NodeVO nodeVO = m_PostService.GetNodeById(nodeId); switch (cmdName) { case "myModify": m_Mode = nodeId; txtNodeName.Text = nodeVO.Name; txtSortNo.Text = nodeVO.SortNo.ToString(); //txtContent.Text = nodeVO.HtmlContent; ShowMode(); break; case "myDel": try { m_PostService.DeleteNode(nodeVO); m_WebLogService.AddSystemLog(MsgVO.Action.刪除, nodeVO); } catch (Exception ex) { ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "js", JavascriptUtil.AlertJS("無法刪除品名,尚有關聯資料。"), false); m_Log.Error(ex); } break; default: break; } GetList(); }
protected void btnUpliad_Click(object sender, EventArgs e) { try { HttpFileCollection hfc = Request.Files; for (int i = 0; i < hfc.Count; i++) { HttpPostedFile hpf = hfc[i]; if (hpf.ContentLength > 0) { string fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + System.IO.Path.GetFileName(hpf.FileName); hpf.SaveAs(Server.MapPath("~\\") + "\\upload\\" + fileName); ltlImg.Text = GetPic(fileName); m_PicFileName = fileName; } else { ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "js", JavascriptUtil.AlertJS("請點選您要上傳的照片!"), false); return; } } } catch { ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "js", JavascriptUtil.AlertJS("檔案傳輸錯誤!"), false); return; } }
protected void btnSave_Click(object sender, EventArgs e) { DateTime date; if (DateTime.TryParse(txtDate.Text.Trim(), out date)) { NodeVO nodeSpecial = m_PostService.GetNodeByName("#特別現金收支"); PostVO postVO = new PostVO(); postVO.Node = nodeSpecial; postVO.CloseDate = date; postVO.Title = txtTitle.Text.Trim(); postVO.Type = int.Parse(ddlType.SelectedValue); if (postVO.Type == 1) { postVO.Price = -1 * (int.Parse(txtPrice.Text.Trim())); } else { postVO.Price = (int.Parse(txtPrice.Text.Trim())); } m_PostService.CreatePost(postVO); UIHelper.ClearUI(pnlSpecialToday); ddlType.SelectedValue = ""; LoadDataToUI(); } else { ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "js", JavascriptUtil.AlertJS("日期格式錯誤!"), false); return; } }
protected void btnChangePassword_Click(object sender, EventArgs e) { LoginUserVO user = m_AuthService.GetLoginUserById(m_SessionHelper.LoginUser.UserId); if (txtOldPassword.Text != user.Password) { ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "js", JavascriptUtil.AlertJS(MsgVO.PASSWORD_WRONG), false); return; } else//txtOldPassword.Text == sHelper.LoginUser.Password { user.Password = txtNewPassword.Text; m_AuthService.UpdateLoginUser(user); m_WebLogService.AddSystemLog(MsgVO.Action.修改, user); ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "js", JavascriptUtil.AlertJS(MsgVO.UPDATE_OK), false); } }
protected void btnUpliad_Click(object sender, EventArgs e) { try { IList <NodeVO> storeList = m_PostService.GetNodeListByParentName("店家"); string folder = Server.MapPath("~\\") + "\\upload\\"; if (!System.IO.Directory.Exists(folder)) { System.IO.Directory.CreateDirectory(folder); } HttpFileCollection hfc = Request.Files; for (int i = 0; i < hfc.Count; i++) { HttpPostedFile hpf = hfc[i]; if (hpf.ContentLength > 0) { string fileName = storeList[0].Name + DateTime.Now.ToString("yyyyMMddHHmmss") + System.IO.Path.GetFileName(hpf.FileName); hpf.SaveAs(Server.MapPath("~\\") + "\\upload\\" + fileName); //ltlFile.Text = GetFile(fileName); lnkFile.Text = fileName; lnkFile.Visible = true; m_FileName = fileName; } else { ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "js", JavascriptUtil.AlertJS("請點選您要上傳的檔案!"), false); return; } } } catch (Exception ex) { m_Log.Error("檔案傳輸錯誤"); m_Log.Error("ex:" + ex.Message); lblMsg.Text = ex.Message; ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "js", JavascriptUtil.AlertJS("檔案傳輸錯誤!"), false); return; } }
protected void btnLogin_Click(object sender, EventArgs e) { string id = txtId.Text.Trim(); string pw = txtPw.Text.Trim(); string confirmationCode = txtConfirmationCode.Text.Trim(); if (string.IsNullOrEmpty(confirmationCode)) { ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "js", JavascriptUtil.AlertJS(MsgVO.SECURCODE_EMPTY), false); return; } if (confirmationCode.ToUpper().Equals(Session["Captcha"].ToString().ToUpper())) { doLogin(id, pw); } else { ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "js", JavascriptUtil.AlertJSAndRedirect(MsgVO.SECURCODE_ERROR, "Login.aspx"), false); } }