public override void OnActionExecuting(ActionExecutingContext filterContext) { //如果未登录 if (!filterContext.HttpContext.User.Identity.IsAuthenticated) { string redirectOnSuccess = filterContext.HttpContext.Request.RawUrl; string redirectUrl = string.Format("?ReturnUrl={0}", redirectOnSuccess); string loginUrl = FormsAuthentication.LoginUrl + redirectUrl; //filterContext.HttpContext.Response.Redirect(loginUrl, true); filterContext.Result = new RedirectResult(loginUrl); } else { string logUserAccount = UserSession.Current.UserAccount; if (string.IsNullOrEmpty(logUserAccount)) { if (filterContext.HttpContext.Request.Cookies["LoginUserAccount"] != null && filterContext.HttpContext.Request.Cookies["LoginDspName"] != null) { string strUserAccount = filterContext.HttpContext.Request.Cookies["LoginUserAccount"].Value; string strUserDspName = filterContext.HttpContext.Request.Cookies["LoginDspName"].Value; if (!string.IsNullOrEmpty(strUserAccount)) { CommonFunction comFun = new CommonFunction(); comFun.setSesssionAndCookies(strUserAccount, HttpUtility.UrlDecode(strUserDspName)); } } } //判断是否存在角色 // 角色包含的可以访问的页面权限是否有权利访问该页面 无权限就跳转到默认无权限页面 //filterContext.Result = new RedirectResult("/Account/warning"); } }
public void TestUCBrowser() { string appPath = @"D:\git-zjs\Appium-Test-ios-android\AppiumDriverDemo\Apps\UCBrowser_V9.8.0.435_Android_pf145_(Build14052717).apk"; DesiredCapabilities cap = new DesiredCapabilities(); //cap.SetCapability("appium-version", "1.0"); cap.SetCapability(CapabilityType.BrowserName, ""); cap.SetCapability("platformName", "Android"); cap.SetCapability("browserName", "UC Browser"); cap.SetCapability("udid", "EAZSRK6HIJHEAYSK"); //三星手机 //4d00627749d2a037 //三星手机2 1844d244 红米手机 //EAZSRK6HIJHEAYSK 小米3 //bba1bd7 cap.SetCapability("app", appPath); //UC Browser设置 cap.SetCapability("appPackage", "com.UCMobile"); cap.SetCapability("appActivity", "com.uc.browser.InnerUCMobile"); driver = new AppiumDriver(new Uri("http://localhost:4723/wd/hub"), cap); Thread.Sleep(2000); IList<IWebElement> ltEle = driver.FindElements(By.ClassName("android.view.View")); ltEle[ltEle.Count - 1].Click(); Thread.Sleep(2000); //IJavaScriptExecutor js = (IJavaScriptExecutor)driver; //Hashtable keycodes = new Hashtable(); //keycodes.Add("KEYCODE_C", "31"); //js.ExecuteScript("mobile:keyevent", keycodes); //Thread.Sleep(5000); CommonFunction comFun = new CommonFunction(); comFun.ITakesScreenshots(driver); Thread.Sleep(2000); driver.Quit(); }
public string PromptUpdatePwdSuccess = string.Empty; //密码修改成功! #endregion Fields #region Methods protected void btnOk_Click(object sender, EventArgs e) { string userid = this.txtUserID.Text; string oldPassword = this.txtOldPassword.Text; CommonFunction comFun = new CommonFunction(); oldPassword = comFun.setMD5Password(oldPassword); string resultDspName = comFun.checkLogin(userid, oldPassword);//登录人显示名 if (string.IsNullOrEmpty(resultDspName) == true) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "oldpassword", "alert('" + PromptOldPwdError + "');", true); return; } string newPassword = this.txtNewPassword.Text.Trim(); string confimrPassword = this.txtConfirmPassword.Text.Trim(); newPassword = comFun.setMD5Password(newPassword); int i = updatePassword(userid, newPassword); if (i == 1) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "success", "alert('" + PromptUpdatePwdSuccess + "');", true); } else { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "fail", "alert('" + PromptUpdatePwdFaild + "');", true); return; } }
protected void gdvPollEdit_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { HiddenField hdnPollQuestionID = e.Row.FindControl("hdnPollQuestionID") as HiddenField; Label lblOptions = e.Row.FindControl("lblOptions") as Label; StringBuilder strContent = new StringBuilder(); var LinqPollList = dbPollEdit.sp_PollView(Int32.Parse(hdnPollQuestionID.Value)); CommonFunction comm = new CommonFunction(); DataTable dt = comm.LINQToDataTable(LinqPollList); for (int i = 0; i < dt.Rows.Count; i++) { strContent.Append("<div class=\"cssClassPollAnswer\">" + dt.Rows[i]["Answer"].ToString()); strContent.Append("</div>"); } strContent.Append("<div class=\"cssClassPollDate\">" + "Poll Active From:" + "<span>" + dt.Rows[0]["PollActiveFrom"].ToString()); strContent.Append("</div>"); strContent.Append("<div class=\"cssClassPollDate\">" + "Poll Active To:" + "<span>" + dt.Rows[0]["PollActiveTo"].ToString()); strContent.Append("</div>"); lblOptions.Text = strContent.ToString(); } } catch (Exception ex) { ProcessException(ex); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString); SageFrameConfig pb = new SageFrameConfig(); hypGotoLogin.NavigateUrl = "~/" + pb.GetSettingsByKey(SageFrameSettingKeys.PlortalLoginpage) + ".aspx"; hypGotoLogin.Text = GetSageMessage("UserRegistration", "GoToLogin"); string ActivationCode = string.Empty; if (Request.QueryString["ActivationCode"] != null) { ActivationCode = Request.QueryString["ActivationCode"].ToString(); try { ActivationCode = EncryptionMD5.Decrypt(ActivationCode); } catch { ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("UserRegistration", "InvalidActivationCode"), "", SageMessageType.Alert); } string UserName = _member.ActivateUser(ActivationCode, GetPortalID, GetStoreID); if (!String.IsNullOrEmpty(UserName)) { UserInfo user = _member.GetUserDetails(GetPortalID, UserName); var messageTemplates = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_SUCCESSFUL_EMAIL, GetPortalID); foreach (var messageTemplate in messageTemplates) { var linqActivationTokenValues = messageTokenDB.sp_GetActivationSuccessfulTokenValue(user.UserName, GetPortalID); CommonFunction comm = new CommonFunction(); DataTable dtActivationSuccessfulTokenValues = comm.LINQToDataTable(linqActivationTokenValues); string replaceMessageSubject = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtActivationSuccessfulTokenValues); string replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtActivationSuccessfulTokenValues); MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, user.Email, replaceMessageSubject, replacedMessageTemplate, string.Empty, string.Empty); } var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_SUCCESSFUL_INFORMATION, GetPortalID).SingleOrDefault(); if (template != null) { ACTIVATION_INFORMATION.Text = template.Body; }; LogInPublicModeRegistration(user); } else { var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_FAIL_INFORMATION, GetPortalID).SingleOrDefault(); if (template != null) { ACTIVATION_INFORMATION.Text = template.Body; }; } } } catch (Exception ex) { ProcessException(ex); } } }
private void MaintainenceCheck(object sender, EventArgs args) { try { CommonFunction objAppController = new CommonFunction(); if (objAppController.IsInstalled()) { HttpApplication app = sender as HttpApplication; HttpContext context = HttpContext.Current; if (context.Request.Path.EndsWith(".aspx")) { XmlDocument doc = new XmlDocument(); doc.Load(context.Server.MapPath("~/Modules/Upgrade/SiteMaintainceConfig.xml")); XmlNode node = doc.SelectSingleNode("/Config/MySection1"); bool flag = Convert.ToBoolean(node.ChildNodes[0].InnerText); if (flag && !context.Request.Path.ToLower().Contains("login.aspx") && !context.Request.Path.Contains(node.ChildNodes[1].InnerText)) { bool IsAdmin = false; if (HttpContext.Current.User != null) { MembershipUser user = Membership.GetUser(); if (user != null) { string[] sysRoles = SystemSetting.SYSTEM_SUPER_ROLES; foreach (string role in sysRoles) { if (Roles.IsUserInRole(user.UserName, role)) { IsAdmin = true; break; } } } if (IsAdmin && (context.Request.Path.ToLower().Contains("/admin/") || context.Request.Path.Contains("/Super-User") || !context.Request.Path.Contains("Upgrade/upgrade.aspx"))) { context.Response.Redirect("~/Modules/Upgrade/upgrade.aspx", true); } } context.Response.Redirect("~" + node.ChildNodes[1].InnerText, false); } } } } catch (Exception ex) { throw; } }
/// <summary> /// 模拟器通过Appium跑H5用例----> 有问题 /// </summary> public void TestH5Appium() { DesiredCapabilities capabilities = new DesiredCapabilities(); //capabilities.SetCapability("appium-version", "1.0"); capabilities.SetCapability("deviceName", "android"); capabilities.SetCapability("udid", "EAZSRK6HIJHEAYSK"); capabilities.SetCapability("BrowserName","UC Browser"); driver = new AppiumDriver(new Uri("http://localhost:4723/wd/hub"), capabilities); driver.Navigate().GoToUrl("http://www.baidu.com"); Thread.Sleep(7000); CommonFunction comFun = new CommonFunction(); comFun.ITakesScreenshots(driver); driver.Quit(); }
protected void btnOK_Click(object sender, EventArgs e) { CommonFunction comFun = new CommonFunction(); string strUserAccount = CommonFunction.StringFilter(this.txtUserAccount.Text.Trim()); string strUserName = CommonFunction.StringFilter(this.txtUserName.Text.Trim()); string strPwd = CommonFunction.StringFilter(this.txtPwd.Text.Trim()); strPwd = comFun.setMD5Password(strPwd); string strEmail = CommonFunction.StringFilter(this.txtEmail.Text.Trim()); string strHRID = CommonFunction.StringFilter(this.txtHRID.Text.Trim()); string strTel = CommonFunction.StringFilter(this.txtTel.Text.Trim()); string strTitle = "";// CommonFunction.StringFilter(this.txtTitle.Text.Trim()); string strUserManager = CommonFunction.StringFilter(this.txtUserManager.Text.Trim()); if (String.IsNullOrEmpty(strTel)) { } try { switch (this.type) { case "add": addUser(strUserAccount, strUserName, strEmail, strPwd, strHRID, strTel, strTitle, strUserManager); this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + GetLocalResourceObject("PromptAddSuccess").ToString() + "');window.location.href='UserManage.aspx'", true); break; case "update": updateUser(strUserAccount, strUserName, strEmail, strPwd, strHRID, strTel, strTitle, strUserManager); this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + GetLocalResourceObject("PromptUpdateSuccess").ToString() + "');window.location.href='UserManage.aspx'", true); break; } // BaseUserInfo.GetUsers(); } catch { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + GetLocalResourceObject("PromptAddFailure").ToString() + "');", true); return; } }
public string Login(string userid, string pwd, string remember) { ViewBag.LoginErrMsg = ""; if (String.IsNullOrEmpty(userid) || String.IsNullOrEmpty(pwd)) { return "用户名或密码错误,请从新输入!"; } string domain = ConfigurationManager.AppSettings["LdapAuthenticationDomain"].ToString(); LdapAuthentication ladAuthBP = new LdapAuthentication(); ViewBag.ErrorMsg = ""; if (ladAuthBP.IsAuthenticated(domain, userid, pwd) && ladAuthBP.GetStatus()) { Hashtable userInfo = ladAuthBP.GetUserInfo(); string userDspName = (userInfo.Count > 0) ? userInfo["cn"].ToString() : ""; FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, "LoginCookieInfo", DateTime.Now, DateTime.Now.AddMinutes(60), false, userid); // User data string encryptedTicket = FormsAuthentication.Encrypt(authTicket); //加密 // 存入Cookie HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); authCookie.Expires = authTicket.Expiration; Response.Cookies.Add(authCookie); if ("true".Equals(remember.ToLower()))//再写入cookie { if (Request.Cookies["RememberMe"] == null || String.IsNullOrEmpty(Response.Cookies["RememberMe"].Value)) { Response.Cookies["RememberMe"].Value = HttpUtility.UrlEncode(userid, System.Text.Encoding.GetEncoding("gb2312")); Response.Cookies["RememberMe"].Expires = DateTime.Now.AddMonths(1); } } else { if (Response.Cookies["RememberMe"] != null) Response.Cookies["RememberMe"].Expires = DateTime.Now.AddDays(-1);//删除 } CommonFunction comFun = new CommonFunction(); comFun.setSesssionAndCookies(userid, userDspName); return "";// RedirectToAction("Index", "Home"); } return "用户名或密码错误,请从新输入!"; }
protected override void OnInitComplete(EventArgs e) { //如果不是mobile,则跳到提示下载的页面 if (!User.Identity.IsAuthenticated) { Response.Redirect("~/Login.aspx"); } CommonFunction comFun = new CommonFunction(); string logUserAccount = UserSession.Current.UserAccount; if (string.IsNullOrEmpty(logUserAccount)) { if (Request.Cookies["LoginUserAccount"] != null && Request.Cookies["LoginDspName"] != null) { string strUserAccount = Request.Cookies["LoginUserAccount"].Value; string strUserDspName = Request.Cookies["LoginDspName"].Value; string strUserGroups = (Request.Cookies["LoginUserGroups"] != null) ? Request.Cookies["LoginUserGroups"].Value : ""; if (!string.IsNullOrEmpty(strUserAccount)) { comFun.setSesssionAndCookies(strUserAccount, HttpUtility.UrlDecode(strUserDspName), HttpUtility.UrlDecode(strUserGroups)); } else { Response.Redirect("~/Login.aspx"); } } else { Response.Redirect("~/Login.aspx"); } } //if (!Request.AppRelativeCurrentExecutionFilePath.ToString().ToLower().Contains("default.aspx")) //{ // if (dtUserPage != null && dtUserPage.Rows.Count > 0 && dtUserPage.Select("Menu_Url ='" + Request.AppRelativeCurrentExecutionFilePath.ToString() + "'").Length <= 0) // { // Response.Redirect("~/WarningPage.aspx"); // } //} }
protected void btnSave_Click(object sender, EventArgs e) { string strQuestion = this.txtQuestion.Text.Trim(); string strAnswer = this.txtAnswer.Text.Trim(); _faqEntity.LogMessages = new HotelVp.Common.Logger.LogMessage(); _faqEntity.LogMessages.Userid = UserSession.Current.UserAccount; _faqEntity.LogMessages.Username = UserSession.Current.UserDspName; _faqEntity.LogMessages.IpAddress = UserSession.Current.UserIP; _faqEntity.FAQDBEntity = new List<FAQDBEntity>(); FAQDBEntity faqDBEntity = new FAQDBEntity(); int id = new CommonFunction().getMaxIDfromSeq("t_lm_qa_seq"); int SeqMax = DbHelperOra.GetMaxID("SEQ", "t_lm_qa", false); faqDBEntity.ID = id; faqDBEntity.QUSETION_HEAD = strQuestion; faqDBEntity.ANSWER_BODY = strAnswer; faqDBEntity.SEQ = SeqMax; _faqEntity.FAQDBEntity.Add(faqDBEntity); FAQBP.Insert(_faqEntity); clearInputText();//清空已经输入的信息 BindGridView(); }
//点击确定按钮 protected void btnOk_Click(object sender, EventArgs e) { if (this.HidFlowBtn.Value == "1") { #region try { if (!chkCashStatus(ViewState["ID"].ToString())) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('该提现申请状态已经更新,请刷新页面!');", true); return; } if (StringUtility.Text_Length(txtRemark.Text.Trim()) > 180) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('处理备注最多60个中文字,请修改!');", true); return; } List<string> list = new List<string>(); //<asp:ListItem Value="0">已提交</asp:ListItem> //<asp:ListItem Value="1">已审核</asp:ListItem> //<asp:ListItem Value="2">已成功</asp:ListItem> //<asp:ListItem Value="3">已失败</asp:ListItem> //<asp:ListItem Value="4">已操作</asp:ListItem> //string process_status = this.ddlProcessStatus.SelectedValue; string process_status = this.hidProcessStatus.Value; //点击按钮当前处理的状态 string pickcashamount = this.lbl_pick_cash_amount_bank.Text;//提现金额 string remark = this.txtRemark.Text; string userRemark = this.txtUserRemark.Text; string User_ID = this.lbl_User_ID_bank.Text; string isPush = (chkPush.Checked) ? "1" : "0"; CommonFunction comFun = new CommonFunction(); int id = comFun.getMaxIDfromSeq("T_LM_CASH_HIS_SEQ");//t_lm_cash_tocash_appl_detl_seq string cashWayCode = this.hidCashWayCode_bank.Value; string strNow = string.Format("{0:yyyy-MM-dd HH:mm:ss}", System.DateTime.Now); //修改主表信息,保留最新一次的备注信息 //string sqlUpdate = "update T_LM_CASH_TOCASH_APPL set PROCESS_STATUS='" + process_status + "',PROCESS_REMARK='" + remark + "',PROCESS_TIME =to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff') ,PROCESS_USERID='" + UserSession.Current.UserAccount + "' where id =" + ViewState["ID"].ToString(); //list.Add(sqlUpdate); ////插入一条新信息到详情表中 //string sqlInsert = "insert into T_LM_CASH_TOCASH_APPL_DETAIL(ID,REF_APPLICATION_ID,USER_ID,HANDLE_STATUS,HANDLE_REMARK,PAY_MODE,HANDLE_TIME,HANDLER) values "; //sqlInsert += "(" + id + ",'" + ViewState["ID"].ToString() + "','" + User_ID + "'," + process_status + ",'" + remark + "','" + cashWayCode + "',to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff'),'" + UserSession.Current.UserAccount + "' )"; //list.Add(sqlInsert); string sqlUpdate = "update T_LM_CASH set STATUS='" + process_status + "',REMARK='" + userRemark + "',PROCESS_REMARK='" + remark + "',UPDATE_TIME =to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff') ,PROCESS_USERID='" + UserSession.Current.UserAccount + "',IS_PUSH='" + isPush + "' where (STATUS <> 2 AND STATUS <> 3) AND SN =" + ViewState["ID"].ToString(); list.Add(sqlUpdate); //插入一条新信息到详情表中 if ("4".Equals(process_status)) { string sqlInserthis = "insert into t_lm_cash_his (id, sn, user_id, status, remark, process_userid, create_time, type, is_push) values "; sqlInserthis += "(" + id + ",'" + ViewState["ID"].ToString() + "','" + User_ID + "'," + "1" + ",'" + remark + "','" + UserSession.Current.UserAccount + "',to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff')," + hidCashType.Value + ",'" + isPush + "')"; list.Add(sqlInserthis); id = comFun.getMaxIDfromSeq("T_LM_CASH_HIS_SEQ");//t_lm_cash_tocash_appl_detl_seq } string sqlInsert = "insert into t_lm_cash_his (id, sn, user_id, status, remark, process_userid, create_time, type, is_push) values "; sqlInsert += "(" + id + ",'" + ViewState["ID"].ToString() + "','" + User_ID + "'," + process_status + ",'" + remark + "','" + UserSession.Current.UserAccount + "',to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff')," + hidCashType.Value + ",'" + isPush + "')"; list.Add(sqlInsert); //点击“已审核” if (process_status == "3") { string sqlCashUser = "******" + pickcashamount + " where USER_ID='" + User_ID + "'"; list.Add(sqlCashUser); } DbHelperOra.ExecuteSqlTran(list); this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('保存成功!');", true); BindLToCash(); setLabelValue(ViewState["ID"].ToString()); if ("1".Equals(isPush)) { PushEntity pushEntity = new PushEntity(); pushEntity.LogMessages = new HotelVp.Common.Logger.LogMessage(); pushEntity.LogMessages.Userid = UserSession.Current.UserAccount; pushEntity.LogMessages.Username = UserSession.Current.UserDspName; pushEntity.LogMessages.IpAddress = UserSession.Current.UserIP; pushEntity.PushDBEntity = new List<PushDBEntity>(); PushDBEntity pushDBEntity = new PushDBEntity(); pushDBEntity.ID = ViewState["ID"].ToString(); pushDBEntity.Content = userRemark; pushDBEntity.Type = "6"; pushDBEntity.TelPhone = User_ID; pushEntity.PushDBEntity.Add(pushDBEntity); PushInfoSA.SendPush(pushEntity); } } catch { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('保存失败!');", true); } #endregion } else { try { if (GetCashBackStatus(ViewState["ID"].ToString()) == "0") { if (!string.IsNullOrEmpty(this.HidPort.Value)) { if (HidPort.Value == "3") { MobilePort_Click(null, null);//手机 } else { AlipayPort_Click(null, null);//支付宝 } } } else { if (GetCashBackStatus(ViewState["ID"].ToString()) == "2") { ScriptManager.RegisterStartupScript(Page, typeof(Page), "fail", "alert('已失败!');", true); } } } catch (Exception ex) { } } ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "alertClose", "BtnCompleteStyle();", true); BindLToCash(); }
private void Login_ADUser() { string userid = this.txtUserID.Text.Trim().ToLower();//登录人账户 string pwd = this.txtPwd.Text.Trim();//登录人密码 if (String.IsNullOrEmpty(userid) || String.IsNullOrEmpty(pwd)) { this.lblRegMsgPopup.Text = "用户名或密码错误,请从新输入!"; return; } string domain = ConfigurationManager.AppSettings["LdapAuthenticationDomain"].ToString(); LdapAuthentication ladAuthBP = new LdapAuthentication(); if (ladAuthBP.IsAuthenticated(domain, userid, pwd) && ladAuthBP.GetStatus()) { Hashtable userInfo = ladAuthBP.GetUserInfo(); string userDspName = (userInfo.Count > 0) ? userInfo["cn"].ToString() : ""; FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, "LoginCookieInfo", DateTime.Now, DateTime.Now.AddMinutes(60), false, userid); // User data string encryptedTicket = FormsAuthentication.Encrypt(authTicket); //加密 // 存入Cookie HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); authCookie.Expires = authTicket.Expiration; Response.Cookies.Add(authCookie); if (chkRemember.Checked)//再写入cookie { if (Request.Cookies["RememberMe"] == null || String.IsNullOrEmpty(Response.Cookies["RememberMe"].Value)) { Response.Cookies["RememberMe"].Value = HttpUtility.UrlEncode(userid, System.Text.Encoding.GetEncoding("gb2312")); Response.Cookies["RememberMe"].Expires = DateTime.Now.AddMonths(1); } } else { if (Response.Cookies["RememberMe"] != null) Response.Cookies["RememberMe"].Expires = DateTime.Now.AddDays(-1);//删除 } CommonFunction comFun = new CommonFunction(); comFun.setSesssionAndCookies(userid, userDspName, ladAuthBP.GetGroups()); this.Response.Redirect("~/Default.aspx"); } this.lblRegMsgPopup.Text = "用户名或密码错误,请从新输入!"; return; }
/// <summary> /// 模拟器跑H5用例 /// </summary> public void TestEmulatorH5() { CommonFunction comFun = new CommonFunction(); comFun.InitivlEvu(DriverType.androidEmulator); }
public void HandlePostRegistration(int UserRegistrationType, MessageTemplateDataContext dbMessageTemplate, int customerId) { switch (UserRegistrationType) { case 0: var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_RESISTER_SUCESSFUL_INFORMATION_NONE, GetPortalID).SingleOrDefault(); if (template != null) { USER_RESISTER_SUCESSFUL_INFORMATION.Text = template.Body; } break; case 1: template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_RESISTER_SUCESSFUL_INFORMATION_PRIVATE, GetPortalID).SingleOrDefault(); if (template != null) { USER_RESISTER_SUCESSFUL_INFORMATION.Text = template.Body; } CheckDivVisibility(false, true); break; case 3: template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_RESISTER_SUCESSFUL_INFORMATION_VERIFIED, GetPortalID).SingleOrDefault(); if (template != null) { USER_RESISTER_SUCESSFUL_INFORMATION.Text = template.Body; } foreach (var messageTemplate in dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACCOUNT_ACTIVATION_EMAIL, GetPortalID)) { CommonFunction comm = new CommonFunction(); DataTable dtActivationTokenValues = comm.LINQToDataTable( messageTokenDB.sp_GetActivationTokenValue(UserName.Text, GetPortalID)); string replaceMessageSubject = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtActivationTokenValues); string replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtActivationTokenValues); MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, Email.Text, replaceMessageSubject, replacedMessageTemplate, string.Empty, string.Empty); } //ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("UserRegistration", "UserRegistrationSuccessPublic"), "", SageMessageType.Success); CheckDivVisibility(false, true); break; case 2: template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.USER_RESISTER_SUCESSFUL_INFORMATION_PUBLIC, GetPortalID).SingleOrDefault(); if (template != null) { USER_RESISTER_SUCESSFUL_INFORMATION.Text = template.Body; } LogInPublicModeRegistration(); //update Cart for that User in AspxCommerce UpdateCartAnonymoususertoRegistered(GetStoreID, GetPortalID, customerId, sessionCode); break; } }
//用于产生新的一个UserCode private string getTicketCode(int length) { CommonFunction comFun = new CommonFunction(); string newCode = comFun.GetRandNumString(length); bool bExist = ExistTicketCode(newCode); if (bExist == false)//表示不存在该Code,则可以加入 { return newCode; } else { //循环100次,如果还不存在,则提示不能再生成了。 int flag = 0; //用于标记,循环100次后,是否有形成可用的ticketcode for (int i = 0; i < 100; i++) { newCode = comFun.GetRandNumString(length); if (ExistTicketCode(newCode) == false) { flag = 1; break; } } if (flag == 1) { return newCode; } else { return ""; } } }
private void BindMessageTemplateType() { try { CommonFunction comm = new CommonFunction(); MessageManagementController objMsgController = new MessageManagementController(); var LINQ = objMsgController.GetMessageTemplateTypeList(true, false, GetPortalID, GetUsername, GetCurrentCultureName); DataTable dtTemplateType = comm.LINQToDataTable(LINQ); ddlMessageTemplateType.DataSource = dtTemplateType; ddlMessageTemplateType.DataTextField = "CultureName"; ddlMessageTemplateType.DataValueField = "MessageTemplateTypeID"; ddlMessageTemplateType.DataBind(); } catch (Exception ex) { ProcessException(ex); } }
private DataTable GetIQCData() { try { DataTable dt = new DataTable(); dt.Columns.Add("IQCNO", typeof(string)); dt.Columns.Add("IQCReceiveDate", typeof(string)); dt.Columns.Add("IQCInspectionDate", typeof(string)); dt.Columns.Add("IQCVenderName", typeof(string)); dt.Columns.Add("IQCPartNumber", typeof(string)); dt.Columns.Add("IQCPartDEsc", typeof(string)); dt.Columns.Add("IQCPurchNo", typeof(string)); dt.Columns.Add("IQCUnit", typeof(string)); dt.Columns.Add("IQCQty", typeof(string)); dt.Columns.Add("IQCMatDocNo", typeof(string)); dt.Columns.Add("IQCBatchNo", typeof(string)); dt.Columns.Add("IQCProcessState", typeof(string)); //dt.Columns.Add("IQCProcessStateDesc", typeof(string)); dt.Columns.Add("IQCInpsectionState", typeof(string)); dt.Columns.Add("IQCSEQ", typeof(int)); CommonFunction commonHandler = new CommonFunction(sessionContext, this); string plantNo = commonHandler.GetSiteNoByStationNo(config.StationNumber); string iqcValue = clientSocket.SendData("{getIQCResultData;" + plantNo + "}"); //clientSocket.SendData("#10;" + plantNo + ";IQC request data#"); LogHelper.Info("Receive message :" + iqcValue); string[] values = iqcValue.Split(new char[] { ';' }); if (values.Length < 4) { LogHelper.Error("No IQC data"); return(null); } int iCount = Convert.ToInt32(values[1]); int iLoop = Convert.ToInt32(values[2]); string strValue = values[3].TrimEnd(new char[] { '#' }); string[] iqcItems = strValue.TrimEnd(new char[] { '}' }).Split(new char[] { '!' }); int iSEQ = 0; for (int i = 0; i < iqcItems.Length; i += iLoop) { iSEQ++; DataRow row = dt.NewRow(); LogHelper.Debug("Row index:" + iSEQ); LogHelper.Debug("Row data:" + iqcItems[i] + ";" + iqcItems[i + 1] + ";" + iqcItems[i + 2] + ";" + iqcItems[i + 3] + iqcItems[i + 4] + ";" + iqcItems[i + 5] + ";" + iqcItems[i + 6] + ";" + iqcItems[i + 7] + iqcItems[i + 8] + ";" + iqcItems[i + 9] + ";" + iqcItems[i + 10] + ";" + iqcItems[i + 11] + ";" + iqcItems[i + 12] + ";" + iqcItems[i + 13]); row["IQCNO"] = iSEQ; row["IQCReceiveDate"] = GetDateTimeStringValue(iqcItems[i]); row["IQCInspectionDate"] = GetDateTimeStringValue(iqcItems[i + 1]); row["IQCVenderName"] = iqcItems[i + 2]; row["IQCPartNumber"] = iqcItems[i + 3]; row["IQCPartDEsc"] = iqcItems[i + 4]; row["IQCPurchNo"] = iqcItems[i + 5]; row["IQCUnit"] = iqcItems[i + 6]; row["IQCQty"] = iqcItems[i + 7]; row["IQCMatDocNo"] = iqcItems[i + 8]; row["IQCBatchNo"] = iqcItems[i + 13]; //iqcItems[i + 9]; row["IQCProcessState"] = iqcItems[i + 11]; //row["IQCProcessStateDesc"] = iqcItems[i + 10] == "0" ? "未检验" : "已检验"; row["IQCInpsectionState"] = GetInspectionState(iqcItems[i + 11]); row["IQCSEQ"] = GetIQCSEQValue(iqcItems[i + 12]); dt.Rows.Add(row); } return(dt); } catch (Exception ex) { LogHelper.Error(ex); return(null); } }
/// 查询数据 /// <summary> /// 查询数据 /// </summary> public List <AgentInfo> GetHollyData() { List <AgentInfo> allagent = MongoDBHelper.GetAllAgentInfo(); //获取查询条件 List <int> select_group = GetSelectComBox(cb_group); List <int> select_state = GetSelectComBox(cb_state); string name = GetTextInput(); //查询有效的数据 List <AgentInfo> data = allagent.Where(x => //所在分组 select_group.Contains(x.BGID) && //状态 select_state.Contains((int)x.CurrStatus) && //文本框 (x.agentDn == name || x.userName.Contains(name) || x.ExtensionNum == name) && //非自己 x.agentDn != LoginUser.AgentNum).ToList(); //排序 if (orderby == OrderBYForListen.工号) { //客服工号排序 data = data.OrderBy(x => CommonFunction.ObjectToInteger(x.agentDn) * -1).ToList(); } else if (orderby == OrderBYForListen.状态) { //状态 工号排序 data = data.OrderBy(x => MongoDBHelper.SortNumber(x.CurrStatus)).ThenBy(x => CommonFunction.ObjectToInteger(x.agentDn) * -1).ToList(); } return(data); }
override public void OnEnter(MatchState lastState) { base.OnEnter(lastState); if (m_match.m_uiMatch != null) { m_match.m_count24TimeStop = false; m_match.m_gameMatchCountStop = false; } foreach (Player player in GameSystem.Instance.mClient.mPlayerManager) { player.m_enableAction = false; player.m_enableMovement = false; player.m_enablePickupDetector = false; player.Hide(); } if (m_match.GetMatchType() != GameMatch.Type.eBullFight && m_match.GetMatchType() != GameMatch.Type.eGrabPoint && m_match.GetMatchType() != GameMatch.Type.eGrabZone && m_match.GetMatchType() != GameMatch.Type.eMassBall && m_match.GetMatchType() != GameMatch.Type.eUltimate21 && m_match.GetMatchType() != GameMatch.Type.eBlockStorm && m_match.GetMatchType() != GameMatch.Type.eReboundStorm) { //m_stateMachine.SetState(MatchState.State.ePlayerCloseUp); m_stateMachine.SetState(MatchState.State.eOpening); return; } playerPrefName = "DontPromptRule_" + MainPlayer.Instance.AccountID + "_" + m_match.m_config.extra_info; bool dontPrompt = (PlayerPrefs.GetInt(playerPrefName) != 0); if (!dontPrompt) { panel = GameSystem.Instance.mClient.mUIManager.CreateUI("Prefab/GUI/MatchRule"); NGUITools.BringForward(panel); //GameObject goRule = panel.transform.FindChild("Window/Rule").gameObject; GameObject goRulePane = panel.transform.FindChild("Window/Rule/RulePane").gameObject; string total = CommonFunction.GetConstString("MATCH_RULE_" + m_match.GetMatchType()); string[] rules = total.Split('\n'); GameObject[] goItem = new GameObject[rules.Length]; goItem[0] = goRulePane.transform.FindChild("1").gameObject; GameObject last = null; for (int i = 0; i < rules.Length; ++i) { if (i >= 1) { goItem[i] = CommonFunction.InstantiateObject(goItem[0], goRulePane.transform); } goItem[i].transform.FindChild("Round/Num").GetComponent <UILabel>().text = (i + 1).ToString(); goItem[i].transform.FindChild("Label").GetComponent <UILabel>().text = rules[i]; UIWidget widget = goItem[i].transform.GetComponent <UIWidget>(); if (last != null) { widget.topAnchor.target = last.transform; widget.topAnchor.Set(0, -12); widget.ResetAnchors(); } last = widget.gameObject; } goRulePane.transform.FindChild("Title").GetComponent <UILabel>().text = CommonFunction.GetConstString("MATCH_TYPE_NAME_" + m_match.GetMatchType().ToString()); //UISprite title = panel.transform.FindChild("Window/Title").GetComponent<UISprite>(); //title.spriteName = "gameInterface_ozd_" + m_match.GetMatchType().ToString(); //title.MakePixelPerfect(); UIEventListener.Get(panel.transform.FindChild("Window/OK").gameObject).onClick += OnOKClick; timer = new GameUtils.Timer4View(GameSystem.Instance.CommonConfig.GetFloat("gRuleDisplayTime"), EndShowRule); if (GameSystem.Instance.mClient.pause) { NGUITools.SetActive(panel.gameObject, false); timer.stop = true; } } else { if (m_match.GetMatchType() == GameMatch.Type.eUltimate21) { m_stateMachine.SetState(MatchState.State.eSlotMachineUltimate21); } else { m_stateMachine.SetState(MatchState.State.eOpening); } //m_stateMachine.SetState(MatchState.State.ePlayerCloseUp); } if (m_match.m_uiMatch != null) { m_match.m_gameMatchCountStop = true; m_match.m_count24TimeStop = true; } }
public void BeforeViewFromDetail() { action = DatabaseConstant.Action.XEM; SetEnabledControls(); CommonFunction.RefreshButton(Toolbar, action, BusinessConstant.TrangThaiNghiepVu.DA_DUYET.layGiaTri(), mnuMain, DatabaseConstant.Function.NS_DM_CNGANH_DTAO_CT); }
public void ProcessRequest(HttpContext context) { BitAuto.YanFa.SysRightManager.Common.UserInfo.Check(); context.Response.ContentType = "text/plain"; string message = ""; if ((context.Request["Action"] + "").Trim() == "InComingCallTotal") { string newAgentIDS = ""; #region 根据AgentNum找到对应的AgentIds if (string.IsNullOrEmpty(this.AgentID)) { if (!string.IsNullOrEmpty(this.AgentNum)) { DataTable dtModel = BLL.EmployeeAgent.Instance.GetEmployeeAgentsByAgentNum(this.AgentNum); string agentIDFromAgentNum = ""; for (int i = 0; i < dtModel.Rows.Count; i++) { agentIDFromAgentNum += "," + dtModel.Rows[i]["UserID"].ToString(); } if (!string.IsNullOrEmpty(agentIDFromAgentNum)) { agentIDFromAgentNum = agentIDFromAgentNum.Substring(1, agentIDFromAgentNum.Length - 1); } if (!string.IsNullOrEmpty(agentIDFromAgentNum)) { newAgentIDS = agentIDFromAgentNum; } else { newAgentIDS = "-100"; } } } else { newAgentIDS = this.AgentID; } #endregion QueryCallRecordInfo query = new QueryCallRecordInfo(); query.BeginTime = Convert.ToDateTime(this.StartTime); query.EndTime = Convert.ToDateTime(this.EndTime); query.QueryType = CommonFunction.ObjectToInteger(this.QueryType); query.LoginID = BLL.Util.GetLoginUserID(); query.selBusinessType = this.BusinessType; query.AgentNum = this.AgentNum; //agentnum query.Agent = this.AgentID; //userid // string tableEndName = BLL.Util.CalcTableNameByMonth(3, CommonFunction.ObjectToDateTime(query.StartTime)); DataTable dt = null; SqlConnection conn = null; try { conn = CallRecordReport.Instance.CreateSqlConnection(); string msg = ""; string searchTableName = "Report_CallRecord_Day"; string searchAgentTableName = "Report_AgentState_Day"; if (DateTime.Now.Date == query.BeginTime.Value.Date && DateTime.Now.Date == query.EndTime.Value.Date) { Dictionary <ReportTempType, string> dic1 = CallRecordReport.Instance.CreateReportCallRecordStatForDayTmp(conn, query.BeginTime.Value, ReportTempType.Day, out msg); searchTableName = dic1[ReportTempType.Day]; Dictionary <ReportTempType, string> dic2 = CallRecordReport.Instance.CreateReportAgentStateStatForDayTmp(conn, query.BeginTime.Value, ReportTempType.Day, out msg); searchAgentTableName = dic2[ReportTempType.Day]; } dt = CallRecordReport.Instance.GetCallInReportDataTotal(query, conn, searchTableName, searchAgentTableName); } catch (Exception) { throw; } finally { CallRecordReport.Instance.CloseSqlConnection(conn); } JsonData jsondata = new JsonData(); if (dt == null || dt.Rows.Count <= 0) { jsondata.N_CallIsQuantity = ""; jsondata.T_RingingTime = ""; jsondata.T_TalkTime = ""; jsondata.T_AfterworkTime = ""; jsondata.T_SetLogin = ""; jsondata.P_WorkTimeUse = ""; jsondata.A_AverageRingTime = ""; jsondata.A_AverageTalkTime = ""; jsondata.A_AfterworkTime = ""; jsondata.T_SetBuzy = ""; jsondata.N_SetBuzy = ""; jsondata.A_AverageSetBusy = ""; jsondata.N_TransferIn = ""; jsondata.N_TransferOut = ""; } else { jsondata.N_CallIsQuantity = dt.Rows[0]["N_CallIsQuantity"].ToString(); jsondata.T_RingingTime = dt.Rows[0]["T_RingingTime"].ToString(); jsondata.T_TalkTime = dt.Rows[0]["T_TalkTime"].ToString(); jsondata.T_AfterworkTime = dt.Rows[0]["T_AfterworkTime"].ToString(); jsondata.T_SetLogin = dt.Rows[0]["T_SetLogin"].ToString(); jsondata.P_WorkTimeUse = dt.Rows[0]["P_WorkTimeUse"].ToString(); jsondata.A_AverageRingTime = dt.Rows[0]["A_AverageRingTime"].ToString(); jsondata.A_AverageTalkTime = dt.Rows[0]["A_AverageTalkTime"].ToString(); jsondata.A_AfterworkTime = dt.Rows[0]["A_AfterworkTime"].ToString(); jsondata.T_SetBuzy = dt.Rows[0]["T_SetBuzy"].ToString(); jsondata.N_SetBuzy = dt.Rows[0]["N_SetBuzy"].ToString(); jsondata.A_AverageSetBusy = dt.Rows[0]["A_AverageSetBusy"].ToString(); jsondata.N_TransferIn = dt.Rows[0]["N_TransferIn"].ToString(); jsondata.N_TransferOut = dt.Rows[0]["N_TransferOut"].ToString(); } message = Newtonsoft.Json.JavaScriptConvert.SerializeObject(jsondata); context.Response.Write(message); context.Response.End(); } else { success = false; message = "request error"; BitAuto.ISDC.CC2012.BLL.AJAXHelper.WrapJsonResponse(success, result, message); } }
protected void Bt_excute_Click(object sender, EventArgs e) { System.IO.DirectoryInfo DirInfo = new System.IO.DirectoryInfo(Server.MapPath("../SingleFile/")); if (!DirInfo.Exists) { return; } System.IO.DirectoryInfo[] Dirs = DirInfo.GetDirectories(); //获取对应语言文件路径集合 FileInfo[] Paths = DirInfo.GetFiles("*." + Request.Form["lang"].ToString()); List <string> files = new List <string>(); //循环Paths 将每个文件信息放入List里 foreach (FileInfo filepath in Paths) { files.Add(filepath.FullName); } if (Paths.Count() <= 1) { Response.Write("<script>alert('对应类型的文件数少于两个')</script>"); } else { TOKEN GenerateToken = new TOKEN(); Sim CalculateSimScore = new Sim(); DFA CalculateDFAScore = new DFA(); List <VN> MarkFile1 = new List <VN>(); List <VN> MarkFile2 = new List <VN>(); Winnowing Win = new Winnowing(); WinText GenerateWinText = new WinText(); CalculateDFAScore.Get_VN(files[0], MarkFile1); CalculateDFAScore.Get_VN(files[1], MarkFile2); //System.Diagnostics.Debug.WriteLine(Markfile1.Count().ToString()); string WinText1 = GenerateWinText.FileFilter(files[0]); string WinText2 = GenerateWinText.FileFilter(files[1]); double WinScore = Win.TextSimilarity(WinText1, WinText2); double SimScore = CalculateSimScore.Sim_Run(GenerateToken.Read_file(files[0]), GenerateToken.Read_file(files[1])); double DFAScore = CalculateDFAScore.GetVarSim(MarkFile1, MarkFile2); double TotalScore = DFAScore * 0.3 + SimScore * 0.5 + WinScore * 0.2; string FileName1 = files[0].Substring(files[0].LastIndexOf('\\') + 1); string FileName2 = files[1].Substring(files[1].LastIndexOf('\\') + 1); Excute_info.Text = FileName1 + " " + FileName2 + " 代码相似度:" + TotalScore.ToString() + "%"; Label3.Text = FileName1; Label2.Text = FileName2; Literal1.Text = "<textarea name=\"code\" class=\"" + GetHighlightLang(Request.Form["lang"].ToString()) + "\" rows=\"15\" cols=\"100\"> " + CommonFunction.GetFileContent(files[0]) + "</textarea>"; Literal2.Text = "<textarea name=\"code\" class=\"" + GetHighlightLang(Request.Form["lang"].ToString()) + "\" rows=\"15\" cols=\"100\"> " + CommonFunction.GetFileContent(files[1]) + "</textarea>"; Upload_info.Text = ""; for (int i = 0; i < files.Count; ++i) { if (System.IO.File.Exists(files[i])) { System.IO.File.Delete(files[i]); } } } }
/// 获取明细表最大时间戳 /// <summary> /// 获取明细表最大时间戳 /// </summary> /// <returns></returns> public long GetAutoCallMaxTimeStamp_Detail() { string sql = "SELECT ISNULL(MAX([TIMESTAMP]),0) FROM dbo.AutoCall_ACDetail"; return(CommonFunction.ObjectToLong(SqlHelper.ExecuteScalar(CONNECTIONSTRINGS, CommandType.Text, sql))); }
protected void wzdForgotPassword_NextButtonClick(object sender, WizardNavigationEventArgs e) { try { if (ValidateCaptcha()) { MembershipController member = new MembershipController(); if (txtEmail.Text != "" && txtUsername.Text != "") { UserInfo user = member.GetUserDetails(GetPortalID, txtUsername.Text); if (user.UserExists) { if (user.IsApproved == true) { if (user.Email.ToLower().Equals(txtEmail.Text.ToLower())) { ForgotPasswordInfo objInfo = UserManagementController.GetMessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_FORGOT_USERNAME_PASSWORD_MATCH, GetPortalID); if (objInfo != null) { ((Literal)WizardStep2.FindControl("litInfoEmailFinish")).Text = objInfo.Body; } List<ForgotPasswordInfo> objList = UserManagementController.GetMessageTemplateListByMessageTemplateTypeID(SystemSetting.PASSWORD_CHANGE_REQUEST_EMAIL, GetPortalID); foreach (ForgotPasswordInfo objPwd in objList) { DataTable dtTokenValues = UserManagementController.GetPasswordRecoveryTokenValue(txtUsername.Text, GetPortalID); CommonFunction comm = new CommonFunction(); string replaceMessageSubject = MessageToken.ReplaceAllMessageToken(objPwd.Subject, dtTokenValues); string replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(objPwd.Body, dtTokenValues); try { MailHelper.SendMailNoAttachment(objPwd.MailFrom, txtEmail.Text, replaceMessageSubject, replacedMessageTemplate, string.Empty, string.Empty); } catch (Exception) { divForgotPwd.Visible = false; ShowMessage("", GetSageMessage("PasswordRecovery", "SecureConnectionFPError"), "", SageMessageType.Alert); e.Cancel = true; } } } else { InitializeCaptcha(); CaptchaValue.Text = string.Empty; ShowMessage("", GetSageMessage("PasswordRecovery", "UsernameOrEmailAddressDoesnotMatched"), "", SageMessageType.Alert); e.Cancel = true; } } else { InitializeCaptcha(); CaptchaValue.Text = string.Empty; ShowMessage("", GetSageMessage("PasswordRecovery", "UsernameNotActivated"), "", SageMessageType.Alert); e.Cancel = true; } } else { InitializeCaptcha(); CaptchaValue.Text = string.Empty; ShowMessage("", GetSageMessage("UserManagement", "UserDoesNotExist"), "", SageMessageType.Alert); e.Cancel = true; } } else { InitializeCaptcha(); e.Cancel = true; CaptchaValue.Text = string.Empty; ShowMessage("", GetSageMessage("PasswordRecovery", "PleaseEnterAllTheRequiredFields"), "", SageMessageType.Alert); } } else { InitializeCaptcha(); e.Cancel = true; CaptchaValue.Text = string.Empty; } } catch (Exception ex) { ProcessException(ex); } }
/* * public void ReadCaptainAttrData() * { * string text = ResourceLoadManager.Instance.GetConfigText(name1); * if (text == null) * { * Debug.LogError("LoadConfig failed: " + name1); * return; * } * captainAttrDatas.Clear(); * * XmlDocument xmlDoc = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_CAPTAINATTR, text); * XmlNodeList nodelist = xmlDoc.SelectSingleNode("Data").ChildNodes; * foreach (XmlElement xe in nodelist) * { * XmlNode comment = xe.SelectSingleNode(GlobalConst.CONFIG_SWITCH_COLUMN); * if (comment != null && comment.InnerText == GlobalConst.CONFIG_SWITCH) * continue; * * uint id = 0; * AttrData attrData = new AttrData(); * foreach (XmlElement xel in xe) * { * if (xel.Name == "ID") * { * uint.TryParse(xel.InnerText, out id); * } * else * { * ReadAttrData(xel, ref attrData); * } * } * if (!captainAttrDatas.ContainsKey(id)) * { * CaptainAttrData captainData = new CaptainAttrData(); * captainData.captainAttrs.Add(attrData); * captainAttrDatas.Add(id, captainData); * } * else * { * captainAttrDatas[id].captainAttrs.Add(attrData); * } * } * } * */ /* * public void ReadRoleAttrData() * { * string text = ResourceLoadManager.Instance.GetConfigText(name2); * if (text == null) * { * Debug.LogError("LoadConfig failed: " + name2); * return; * } * roleAttrDatas.Clear(); * * XmlDocument xmlDoc = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_ROLEATTR, text); * XmlNodeList nodelist = xmlDoc.SelectSingleNode("Data").ChildNodes; * foreach (XmlElement xe in nodelist) * { * XmlNode comment = xe.SelectSingleNode(GlobalConst.CONFIG_SWITCH_COLUMN); * if (comment != null && comment.InnerText == GlobalConst.CONFIG_SWITCH) * continue; * * uint id = 0; * AttrData attrData = new AttrData(); * foreach (XmlElement xel in xe) * { * if (xel.Name == "ID") * { * uint.TryParse(xel.InnerText, out id); * } * else * { * ReadAttrData(xel, ref attrData); * } * } * if (!roleAttrDatas.ContainsKey(id)) * { * RoleAttrData roleData = new RoleAttrData(); * roleData.roleAttrs.Add(attrData); * roleAttrDatas.Add(id, roleData); * } * else * { * roleAttrDatas[id].roleAttrs.Add(attrData); * } * } * } * */ public void ReadRobotAttrData() { string text = ResourceLoadManager.Instance.GetConfigText(name3); if (text == null) { Debug.LogError("LoadConfig failed: " + name3); return; } robotAttrDatas.Clear(); XmlDocument xmlDoc = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_ROBOTATTR, text); XmlNodeList nodelist = xmlDoc.SelectSingleNode("Data").ChildNodes; foreach (XmlElement xe in nodelist) { XmlNode comment = xe.SelectSingleNode(GlobalConst.CONFIG_SWITCH_COLUMN); if (comment != null && comment.InnerText == GlobalConst.CONFIG_SWITCH) { continue; } RobotAttrData data = new RobotAttrData(); data.attrData = new AttrData(); foreach (XmlElement xel in xe) { if (xel.Name == "min_level") { uint.TryParse(xel.InnerText, out data.min_level); } else if (xel.Name == "max_level") { uint.TryParse(xel.InnerText, out data.max_level); } else if (xel.Name == "winning_streak") { uint.TryParse(xel.InnerText, out data.winning_streak); } else if (xel.Name == "position") { uint value = 0; uint.TryParse(xel.InnerText, out value); data.position = (PositionType)value; } else if (xel.Name == "passive_skill") { string[] tokens = xel.InnerText.Split('&'); foreach (string token in tokens) { uint skill_id; if (uint.TryParse(token, out skill_id)) { data.attrData.skills.Add(skill_id); } } } else if (xel.Name == "active_skill") { string[] tokens = xel.InnerText.Split('&'); foreach (string token in tokens) { uint skill_id; if (uint.TryParse(token, out skill_id)) { data.attrData.skills.Add(skill_id); } } } else { ReadAttrData(xel, ref data.attrData); } } var existed = (from d in robotAttrDatas where d.min_level == data.min_level && d.max_level == data.max_level && d.winning_streak == data.winning_streak && d.position == data.position select d).FirstOrDefault(); if (existed == null) { robotAttrDatas.Add(data); } else { Debug.LogError(string.Format("Robot attr config repeating. min_level:{0} max_level:{1} winning_streak:{2} position:{3}", data.min_level, data.max_level, data.winning_streak, data.position)); } } }
/// 获取任务表最大时间戳 /// <summary> /// 获取任务表最大时间戳 /// </summary> /// <returns></returns> public long GetAutoCallMaxTimeStamp_Task_XA() { string sql = "SELECT ISNULL(MAX([TIMESTAMP]),0) FROM dbo.AutoCall_TaskInfo"; return(CommonFunction.ObjectToLong(SqlHelper.ExecuteScalar(ConnectionStrings_Holly_Business, CommandType.Text, sql))); }
protected override void OnLoadControlComplete() { base.OnLoadControlComplete(); DetailGrid grid = this.EditForm.FindControl("OrderGrid") as DetailGrid; if (grid != null) { grid.P1.Visibility = System.Windows.Visibility.Visible; List <ToolbarItem> list = new List <ToolbarItem>(); ToolbarItem item = new ToolbarItem { DisplayType = ToolbarItemDisplayTypes.Image, Key = "S1", Title = "按科目查看", ImageUrl = "/SMT.SaaS.FrameworkUI;Component/Images/ToolBar/18_addView.png", }; list.Add(item); item = new ToolbarItem { DisplayType = ToolbarItemDisplayTypes.Image, Key = "S2", Title = "按公司部门单据查看", ImageUrl = "/SMT.SaaS.FrameworkUI;Component/Images/ToolBar/18_addView.png" }; list.Add(item); grid.AddToolBarItems(list); } var dGrid = grid; dGrid.ADGrid.LoadingRow += (object sender, DataGridRowEventArgs e) => { if ((this.EditForm.OperationType == OperationTypes.Add || this.EditForm.OperationType == OperationTypes.Edit || this.EditForm.OperationType == OperationTypes.ReSubmit) && SumType == 1) { var con = dGrid.ADGrid.Columns[7].GetCellContent(e.Row) as StackPanel; Action a2 = () => { Label label = new Label(); label.Content = "已打回"; con.Children.Clear(); con.Children.Add(label); }; Action a1 = () => { ImageButton myButton = new ImageButton(); myButton.Margin = new Thickness(0); myButton.AddButtonAction("/SMT.SaaS.FrameworkUI;Component/Images/ToolBar/ico_16_delete.png", "打回"); myButton.Tag = e.Row.DataContext; myButton.Click += (oo, ee) => { Control c = oo as Control; var entity = c.Tag as FBEntity; Action action = () => { // dGrid.Delete(new List<FBEntity> { entity }); var saveEntity = entity.Entity.ToFBEntity(); saveEntity.SetObjValue("Entity.CHECKSTATES", 4); saveEntity.FBEntityState = FBEntityState.Modified; FBEntityService fbs = new FBEntityService(); fbs.SetVisitUser(saveEntity); fbs.FBService.SaveCompleted += (ooo, eee) => { this.CloseProcess(); if (eee.Error != null) { CommonFunction.ShowErrorMessage("操作失败, " + eee.Error.Message); } else if (eee.Result.Exception != null) { CommonFunction.ShowErrorMessage(eee.Result.Exception); } else { a2(); } }; this.ShowProcess(); CurrentUserPost user = new CurrentUserPost(); user.EmployeeName = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeName; user.EmployeeID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID; user.PostName = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostName; user.DepartmentName = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentName; user.CompanyName = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyName; fbs.FBService.SaveAsync(saveEntity, user); // none; }; var personName = entity.GetObjValue("Entity.T_FB_COMPANYBUDGETAPPLYMASTER.OWNERDEPARTMENTNAME"); var msg = "你确定要打回 [" + personName + "] 的部门年度预算吗?"; CommonFunction.AskDelete(msg, action); }; con.Children.Clear(); con.Children.Add(myButton); }; var cs = e.Row.DataContext.GetObjValue("Entity.CHECKSTATES") as decimal?; if (cs.Equal(4)) { a2(); } else { a1(); } } }; grid.deatilGridBar.ItemClicked += new EventHandler <ToolBar.ToolBarItemClickArgs>(deatilGridBar_ItemClicked); deatilGridBar_ItemClicked(grid, new ToolBar.ToolBarItemClickArgs("S1")); }
public ResponseModel BulkUploadSLA() { SettingsCaller newSLA = new SettingsCaller(); ResponseModel objResponseModel = new ResponseModel(); int statusCode = 0; string statusMessage = ""; string fileName = ""; string finalAttchment = ""; string timeStamp = DateTime.Now.ToString("ddmmyyyyhhssfff"); DataSet dataSetCSV = new DataSet(); string[] filesName = null; try { var files = Request.Form.Files; string token = Convert.ToString(Request.Headers["X-Authorized-Token"]); Authenticate authenticate = new Authenticate(); authenticate = SecurityService.GetAuthenticateDataFromTokenCache(Cache, SecurityService.DecryptStringAES(token)); #region Read from Form if (files.Count > 0) { for (int i = 0; i < files.Count; i++) { fileName += files[i].FileName.Replace(".", "_" + authenticate.UserMasterID + "_" + timeStamp + ".") + ","; } finalAttchment = fileName.TrimEnd(','); } var exePath = Path.GetDirectoryName(System.Reflection .Assembly.GetExecutingAssembly().CodeBase); Regex appPathMatcher = new Regex(@"(?<!fil)[A-Za-z]:\\+[\S\s]*?(?=\\+bin)"); var appRoot = appPathMatcher.Match(exePath).Value; string Folderpath = appRoot + "\\" + "BulkUpload\\SLA"; if (files.Count > 0) { filesName = finalAttchment.Split(","); for (int i = 0; i < files.Count; i++) { using (var ms = new MemoryStream()) { files[i].CopyTo(ms); var fileBytes = ms.ToArray(); MemoryStream msfile = new MemoryStream(fileBytes); FileStream docFile = new FileStream(Folderpath + "\\" + filesName[i], FileMode.Create, FileAccess.Write); msfile.WriteTo(docFile); docFile.Close(); ms.Close(); msfile.Close(); } } } dataSetCSV = CommonService.csvToDataSet(Folderpath + "\\" + filesName[0]); #endregion // DataSetCSV = CommonService.csvToDataSet("D:\\TP\\hierarchymaster.csv"); int result = newSLA.SLABulkUpload(new SLAServices(Cache, Db), authenticate.TenantId, authenticate.UserMasterID, dataSetCSV); statusCode = result > 0 ? (int)EnumMaster.StatusCode.Success : (int)EnumMaster.StatusCode.RecordNotFound; statusMessage = CommonFunction.GetEnumDescription((EnumMaster.StatusCode)statusCode); objResponseModel.Status = true; objResponseModel.StatusCode = statusCode; objResponseModel.Message = statusMessage; objResponseModel.ResponseData = result; } catch (Exception) { throw; } return(objResponseModel); }
protected bool right_export; //导出权限 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int userID = BLL.Util.GetLoginUserID(); right_allocation = BLL.Util.CheckRight(userID, "SYS024BUT10110101"); right_withdraw = BLL.Util.CheckRight(userID, "SYS024BUT10110102"); right_export = BLL.Util.CheckRight(userID, "SYS024BUT10110103"); DataTable dt = BitAuto.YanFa.Crm2009.BLL.AreaInfo.Instance.GetAllDistrict(); selArea.Items.Add(new ListItem("请选择", "-1")); foreach (DataRow dr in dt.Rows) { selArea.Items.Add(new ListItem(CommonFunction.ObjectToString(dr["DepartName"]), CommonFunction.ObjectToString(dr["DepartID"]))); } } }
private void SendActivateMail(UserInfo user) { var dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString); MessageTokenDataContext messageTokenDB = new MessageTokenDataContext(SystemSetting.SageFrameConnectionString); var messageTemplates = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.ACTIVATION_SUCCESSFUL_EMAIL, GetPortalID); foreach (var messageTemplate in messageTemplates) { var linqActivationTokenValues = messageTokenDB.sp_GetActivationSuccessfulTokenValue(user.UserName, GetPortalID); CommonFunction comm = new CommonFunction(); DataTable dtActivationSuccessfulTokenValues = comm.LINQToDataTable(linqActivationTokenValues); string replaceMessageSubject = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtActivationSuccessfulTokenValues); string replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtActivationSuccessfulTokenValues); try { MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, user.Email, replaceMessageSubject, replacedMessageTemplate, string.Empty, string.Empty); } catch (Exception) { ShowMessage("", GetSageMessage("UserRegistration", "SecureConnectionUAEmailError"), "", SageMessageType.Alert); return; } } }
private void SetReportParameters(DateTime openDate) { //Bottom Part of the report double immaturedBalance = 0; double maturedBalance = 0; //double openingBalance = 0; double unClearCheque = 0; double totalDeposit = 0; double totalWithDraw = 0; double totalCharges = 0; double ledgerBalance = 0; double realizeGain = 0; double nav = 0; double depitratio = 0; double exposure = 0; //Client AccountS tatus SqlCommand cmdStatusDetailsAsOn = new SqlCommand("GetClientAccountStatusDetailsAsOn", sqlConnect); cmdStatusDetailsAsOn.CommandType = CommandType.StoredProcedure; cmdStatusDetailsAsOn.Parameters.Add("@AccountRef", SqlDbType.VarChar).Value = session.AccountNumber; cmdStatusDetailsAsOn.Parameters.Add("@LedgerDate", SqlDbType.DateTime).Value = DateTime.Now.ToString("yyyy/MM/dd"); SqlDataAdapter sdaClientAccountStatusDetailsAsOn = new SqlDataAdapter(cmdStatusDetailsAsOn); DataTable dtClientAccountStatusDetailsAsOn = new DataTable(); //DataSet dsInvestorPortfolioList = new DataSet(); //dt = ds.Tables["YourTableName"]; sdaClientAccountStatusDetailsAsOn.Fill(dtClientAccountStatusDetailsAsOn); if (dtClientAccountStatusDetailsAsOn != null) { if (dtClientAccountStatusDetailsAsOn.Rows.Count > 0) { foreach (DataRow dr in dtClientAccountStatusDetailsAsOn.Rows) { immaturedBalance = Convert.ToDouble(dr["ImmaturedSale"]); ledgerBalance = Convert.ToDouble(dr["LedgerBalance"]); maturedBalance = Convert.ToDouble(dr["AvailableBalance"]); unClearCheque = Convert.ToDouble(dr["UnclearCheque"]); //immaturedBalance = ledgerBalance - AvailableBalance; } } } //Investor Financial Position SqlCommand CmdFinancialPosition = new SqlCommand("InvestorFinancialPosition", sqlConnect); CmdFinancialPosition.CommandType = CommandType.StoredProcedure; CmdFinancialPosition.Parameters.Add("@AccountRef", SqlDbType.VarChar).Value = session.AccountNumber; CmdFinancialPosition.Parameters.Add("@LedgerDate", SqlDbType.DateTime).Value = openDate.ToString("yyyy-MM-dd"); SqlDataAdapter sdaInvestorFinancialPosition = new SqlDataAdapter(CmdFinancialPosition); DataTable dtFinancialPosition = new DataTable(); sdaInvestorFinancialPosition.Fill(dtFinancialPosition); if (dtFinancialPosition != null) { if (dtFinancialPosition.Rows.Count > 0) { foreach (DataRow dr in dtFinancialPosition.Rows) { totalDeposit = Convert.ToDouble(dr["TOTALINVESTMENT"]); realizeGain = Convert.ToDouble(dr["REALIZEDGAIN"]); totalWithDraw = Convert.ToDouble(dr["TOTALWITHDRAW"]); totalCharges = Convert.ToDouble(dr["ACCRUEDINTEREST"]); } } } //Report Parameters oInvestorProtfilioStatement.SetParameterValue("ReportTitle", "Investor Portfolio Statement"); oInvestorProtfilioStatement.SetParameterValue("CashBalance", ledgerBalance); oInvestorProtfilioStatement.SetParameterValue("AmountReceivable", immaturedBalance); oInvestorProtfilioStatement.SetParameterValue("UnClearCheque", unClearCheque); oInvestorProtfilioStatement.SetParameterValue("TotalDeposit", totalDeposit); //oInvestorProtfilioStatement.SetParameterValue("RealizeGain", oInvestor.RealisedGain); oInvestorProtfilioStatement.SetParameterValue("RealizeGain", realizeGain); oInvestorProtfilioStatement.SetParameterValue("TotalWithdraw", totalWithDraw); oInvestorProtfilioStatement.SetParameterValue("AccruedCommission", totalCharges); oInvestorProtfilioStatement.SetParameterValue("NAV", nav); double loan = 0.00; //if (oInvestor.InvestorGroup.MarginCategory != null) //{ // loan = oInvestor.InvestorGroup.MarginCategory.MarginRatio; //} oInvestorProtfilioStatement.SetParameterValue("LoanRatio", loan); oInvestorProtfilioStatement.SetParameterValue("DepitRatio", depitratio); oInvestorProtfilioStatement.SetParameterValue("Exposure", exposure); oInvestorProtfilioStatement.SetParameterValue("BONumber", session.BoNumber); oInvestorProtfilioStatement.SetParameterValue("AccountType", string.Empty); oInvestorProtfilioStatement.SetParameterValue("PortfolioDate", openDate.ToString("dd-MMM-yyyy")); oInvestorProtfilioStatement.SetParameterValue("AccountCode", session.AccountNumber); oInvestorProtfilioStatement.SetParameterValue("AccountName", session.AccountName); CommonFunction cmDataTable = new CommonFunction(); string query = "select Address,Telephone,Fax,Email,ExchangeID,Web,BrokerName from Broker"; DataTable dtbrokerRef = cmDataTable.GetDatatable(query); if (dtbrokerRef.Rows.Count > 0) { oInvestorProtfilioStatement.SetParameterValue("Address", dtbrokerRef.Rows[0]["Address"].ToString()); oInvestorProtfilioStatement.SetParameterValue("Telephone", dtbrokerRef.Rows[0]["Telephone"].ToString()); oInvestorProtfilioStatement.SetParameterValue("Email", dtbrokerRef.Rows[0]["Email"].ToString()); oInvestorProtfilioStatement.SetParameterValue("Web", dtbrokerRef.Rows[0]["Web"].ToString()); oInvestorProtfilioStatement.SetParameterValue("Fax", dtbrokerRef.Rows[0]["Fax"].ToString()); oInvestorProtfilioStatement.SetParameterValue("StockExchange", dtbrokerRef.Rows[0]["ExchangeID"].ToString()); oInvestorProtfilioStatement.SetParameterValue("CompanyName", dtbrokerRef.Rows[0]["BrokerName"].ToString()); } oInvestorProtfilioStatement.SetParameterValue("Branch", string.Empty); oInvestorProtfilioStatement.SetParameterValue("CDBL", string.Empty); }
public MasterTouroku_DenpyouNO() { InitializeComponent(); cf = new CommonFunction(); }
/// <summary> /// 动画结束时调用 /// </summary> void OnFinish() { CommonFunction.SetAnimatorShade(false); }
private void ShowWorkShopDetails(string EventeId) { try { StringBuilder s = new StringBuilder(); objCommon = new CommonFunction(); DataSet dset = new DataSet(); int iUserID = ((UserDetails)Session[clsConstant.TOKEN]).UserID; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@EventeId", Request.QueryString["EventID"].ToString()) }; dset = objCommon.getEventData("USp_SelectWorkshopDetailsWB", param); if (dset.Tables[0].Rows.Count > 0) { #region ShowRecordOfWorkShopDetails lblworkshopId.Text = dset.Tables[0].Rows[0]["iNominationID"].ToString(); lblTopicName.Text = dset.Tables[0].Rows[0]["vsTopic"].ToString(); lblFromdate.Text = Convert.ToDateTime(dset.Tables[0].Rows[0]["dtFromDate"].ToString()).ToString("dd MMM yyyy"); lblToDate.Text = Convert.ToDateTime(dset.Tables[0].Rows[0]["dtToDate"].ToString()).ToString("dd MMM yyyy"); lblVenue.Text = dset.Tables[0].Rows[0]["VsVenue"].ToString(); lblSponsored.Text = dset.Tables[0].Rows[0]["Sponsored"].ToString(); lblNomination.Text = dset.Tables[0].Rows[0]["iSeats"].ToString(); lblStatus.Text = dset.Tables[0].Rows[0]["Status"].ToString(); lblType.Text = dset.Tables[0].Rows[0]["iSeats"].ToString(); lblSector.Text = dset.Tables[0].Rows[0]["iDocCatID"].ToString(); lblInviteBy.Text = dset.Tables[0].Rows[0]["Invite"].ToString(); lblSendTo.Text = dset.Tables[0].Rows[0]["name"].ToString(); lblDEAClearanceStatus.Text = dset.Tables[0].Rows[0]["ClearanceStatus"].ToString(); lblLastDate.Text = dset.Tables[0].Rows[0]["dtLastDate"].ToString(); lblRemarks.Text = dset.Tables[0].Rows[0]["Remarks"].ToString(); if (dset.Tables[0].Rows[0]["Attachment1"].ToString() != "") { ViewState["Attachment1"] = dset.Tables[0].Rows[0]["Attachment1"].ToString(); } else { lnkAttachment1.Text = "Not Available"; lnkAttachment1.Enabled = false; } if (dset.Tables[0].Rows[0]["Attachment2"].ToString() != "") { ViewState["Attachment2"] = dset.Tables[0].Rows[0]["Attachment2"].ToString(); } else { lnkAttachment2.Text = "Not Available"; lnkAttachment2.Enabled = false; } #endregion } #region ShowWorkshopDetailsOfNominatedUser if (dset.Tables[1].Rows.Count > 0) { s.Append("<tr class='TrClass' style='background-color: #337ab7;color: white;'>"); s.Append("<td class='TdClass'>Name</td>"); s.Append("<td class='TdClass'>Organisation</td>"); s.Append("<td class='TdClass'>Designation</td>"); s.Append("<td class='TdClass'>Email</td>"); s.Append("<td class='TdClass'>Mobile</td>"); s.Append("<td class='TdClass'>Telephone</td>"); s.Append("<td class='TdClass'>Status</td>"); s.Append("</tr>"); for (int i = 0; i < dset.Tables[1].Rows.Count; i++) { s.Append("<tr class='TrClass'>"); s.Append("<td class='TdClass'>" + dset.Tables[1].Rows[i]["vsName"].ToString() + "</td>"); s.Append("<td class='TdClass'>" + dset.Tables[1].Rows[i]["vsOrganisation"].ToString() + "</td>"); s.Append("<td class='TdClass'>" + dset.Tables[1].Rows[i]["vsDesignationID"].ToString() + "</td>"); s.Append("<td class='TdClass'>" + dset.Tables[1].Rows[i]["vsEmail"].ToString() + "</td>"); s.Append("<td class='TdClass'>" + dset.Tables[1].Rows[i]["vsCellphone"].ToString() + "</td>"); s.Append("<td class='TdClass'>" + dset.Tables[1].Rows[i]["vsTelephone"].ToString() + "</td>"); s.Append("<td class='TdClass'>" + dset.Tables[1].Rows[i]["vsStatus"].ToString() + "</td>"); s.Append("</tr>"); } lblNominationUserMessage.Text = s.ToString(); s = s.Clear(); } else { lblNominationUserMessage.Text = "Currently Nominated users are not available!"; } #endregion #region ToList if (dset.Tables[2].Rows.Count > 0) { s.Append("<tr class='TrClass' style='background-color: #337ab7;color: white;'>"); s.Append("<th class='TdClass'>Details </th>"); s.Append("</tr>"); for (int i = 0; i < dset.Tables[2].Rows.Count; i++) { s.Append("<tr class='TrClass'>"); s.Append("<td class='TdClass'>" + dset.Tables[2].Rows[i]["ToName"].ToString() + "</td>"); s.Append("</tr>"); } lblToDlts.Text = s.ToString(); s = s.Clear(); } else { lblToDlts.Text = "Currently To users are not available!"; lblToDlts.ForeColor = System.Drawing.Color.Red; } #endregion #region ToCCList if (dset.Tables[3].Rows.Count > 0) { s.Append("<tr class='TrClass' style='background-color: #337ab7;color: white;'>"); s.Append("<th class='TdClass'>Details :</th>"); s.Append("</tr>"); for (int i = 0; i < dset.Tables[3].Rows.Count; i++) { s.Append("<tr class='TrClass'>"); s.Append("<td class='TdClass'>" + dset.Tables[3].Rows[i]["ToNameCC"].ToString() + "</td>"); s.Append("</tr>"); } lblToCCdtls.Text = s.ToString(); s = s.Clear(); } else { lblToCCdtls.Text = "Currently CC users are not available!"; lblToCCdtls.ForeColor = System.Drawing.Color.Red; } #endregion } catch (Exception ex) { } }
protected override void InitializeCulture() { // Imposta la lingua della pagina Thread.CurrentThread.CurrentUICulture = CommonFunction.GetCulture(); }
private void Login_KFCUser() { //string strUserAccount = this.txtUserID.Text.Trim();//登录人账户 //string strPwd = this.txtPwd.Text.Trim();//登录人密码 //CommonFunction comFun = new CommonFunction(); //strPwd = comFun.setMD5Password(strPwd);//md5加密 //string resultDspName = comFun.checkLogin(strUserAccount, strPwd);//登录人显示名 //if (!string.IsNullOrEmpty(resultDspName)) //{ // comFun.setSesssionAndCookies(strUserAccount,resultDspName); // this.Response.Redirect("~/Default.aspx"); //} //else //{ // this.lblRegMsgPopup.Text = "登录失败!"; // return; //} string strUserAccount = this.txtUserID.Text.Trim();//登录人账户 string strPwd = this.txtPwd.Text.Trim();//登录人密码 CommonFunction comFun = new CommonFunction(); strPwd = comFun.setMD5Password(strPwd);//md5加密 string strTemp = comFun.checkLogin(strUserAccount, strPwd); string resultDspName = strTemp.Split(',')[1];//登录人显示名 strUserAccount = strTemp.Split(',')[0]; if (!string.IsNullOrEmpty(resultDspName)) { //System.Web.Security.FormsAuthentication.SetAuthCookie(strUserAccount, false); FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, "LoginCookieInfo", DateTime.Now, DateTime.Now.AddMinutes(60), false, strUserAccount); // User data string encryptedTicket = FormsAuthentication.Encrypt(authTicket); //加密 // 存入Cookie HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); authCookie.Expires = authTicket.Expiration; Response.Cookies.Add(authCookie); if (chkRemember.Checked)//再写入cookie { if (Request.Cookies["RememberMe"] == null || String.IsNullOrEmpty(Response.Cookies["RememberMe"].Value)) { Response.Cookies["RememberMe"].Value = HttpUtility.UrlEncode(strUserAccount, System.Text.Encoding.GetEncoding("gb2312")); Response.Cookies["RememberMe"].Expires = DateTime.Now.AddMonths(1); } } else { if (Response.Cookies["RememberMe"] != null) Response.Cookies["RememberMe"].Expires = DateTime.Now.AddDays(-1);//删除 } comFun.setSesssionAndCookies(strUserAccount, resultDspName, ""); this.Response.Redirect("~/Default.aspx"); //if (Request.QueryString.ToString().Contains("ReturnUrl") && !String.IsNullOrEmpty(Request.QueryString["ReturnUrl"].ToString())) //{ // this.Response.Redirect(Request.QueryString["ReturnUrl"].ToString()); //} //else //{ // this.Response.Redirect("~/Default.aspx"); //} } else { this.lblRegMsgPopup.Text = "登录失败!"; return; } }
protected void btnGrantTicket_Click(object sender, EventArgs e) { try { if (!chkTicketPageDate()) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('该优惠券已过最迟领用日期,无法领用,请确认!');", true); return; } string strPackageCode = this.txtPackageCode.Value; string strRemainCount = this.lblRestCount.Text;//剩余可以生成的张数 int intRemainCount = 0; string fileExt = System.IO.Path.GetExtension(PhoneFlUpload.FileName); if (!String.IsNullOrEmpty(fileExt)) { string allowexts = (ConfigurationManager.AppSettings["AllowUploadFileType"] != null) ? ConfigurationManager.AppSettings["AllowUploadFileType"].ToString() : ""; //定义允许上传文件类型 if (allowexts == "") { allowexts = ".*xls|.*xlsx|.*txt"; } Regex allowext = new Regex(allowexts); if (!allowext.IsMatch(fileExt)) //检查文件大小及扩展名 { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('选择文件类型不正确,请确认!');", true); return; } } string strPhoneNumber = this.txtPhoneNumber.Text.Replace(" ", "");//电话号码 strPhoneNumber = strPhoneNumber.Trim(','); strPhoneNumber = (strPhoneNumber.Length > 0) ? getFileData() + "," + strPhoneNumber : getFileData(); strPhoneNumber = CommonFunction.StringFilter(strPhoneNumber); strPhoneNumber = strPhoneNumber.Trim(','); string[] arrPhone = strPhoneNumber.Split(',');//用逗号进行分隔。 if (String.IsNullOrEmpty(strPhoneNumber) || arrPhone.Length == 0) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('请添加发送手机号码!');", true); return; } if (!string.IsNullOrEmpty(strRemainCount)) { intRemainCount = Convert.ToInt32(strRemainCount); } if (intRemainCount <= 0) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + PromptPackageHaveFinish + "');", true); return;//后面就不执行了 } if (intRemainCount < arrPhone.Length) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + PromptLeaveCount + "" + intRemainCount.ToString() + "" + PromptActualCreate + "" + arrPhone.Length.ToString() + "" + Count + "');", true); return;//后面就不执行了 } bool bCanUse = CanUse(strPackageCode); if (bCanUse == false) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + PromptTicketNotUse + "');", true); return;//后面就不执行了 } if (getTicketCount(strPackageCode) == false) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + PromptTicketCountMustOne + "');", true); return; } //string repeatPhone = string.Empty; CommonFunction comFun = new CommonFunction(); //bool bollMobileNum = true; //string strTempPhone = string.Empty; //for (int j = 0; j < arrPhone.Length; j++) //{ // strTempPhone = arrPhone[j]; // //bollMobileNum = comFun.IsMobileNumber(strTempPhone); // //if (bollMobileNum == false) // //{ // // break; // //} // int intFlag = 0; // for (int k = 0; k < arrPhone.Length; k++) // { // if (strTempPhone == arrPhone[k]) // { // intFlag += 1; // } // } // if (intFlag > 1) // { // repeatPhone = repeatPhone + strTempPhone + ","; // } //} //repeatPhone = repeatPhone.Trim(',').Trim(); ////判断有没有不合法的手机号 //if (bollMobileNum == false) //{ // this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + PromptPhoneFormatError + "" + strTempPhone + "!');", true); // return; //} ////判断有没有相同的号码 //if (!string.IsNullOrEmpty(repeatPhone)) //{ // this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + PromptHaveSamePhone + "" + repeatPhone + "!');", true); // return; //} //根据PackageCode查询ticketcode和该ticketcode的amount. string sqlTicket = "select * from T_LM_TICKET where PACKAGECODE=:PACKAGECODE"; OracleParameter[] parmPack = { new OracleParameter("PACKAGECODE", OracleType.VarChar) }; parmPack[0].Value = strPackageCode; DataTable dt = DbHelperOra.Query(sqlTicket, false, parmPack).Tables[0]; string ticketCode = dt.Rows[0]["TICKETCODE"].ToString(); string ticketAmt = dt.Rows[0]["TICKETAMT"].ToString(); List<CommandInfo> sqlList = new List<CommandInfo>(); StringBuilder sqlInsert = new StringBuilder(); //Oracle sql 语法 sqlInsert.AppendLine("INSERT INTO T_LM_TICKET_USER(ID,TICKETCODE,TICKETUSERCODE,STATUS,TICKETAMT,PACKAGECODE,FLAG,USERID,CREATETIME,UPDATETIME) VALUES ( "); sqlInsert.AppendLine("T_LM_TICKET_USER_SEQ.nextval,:TICKETCODE,:TICKETUSERCODE,:STATUS,:TICKETAMT,:PACKAGECODE,:FLAG,:USERID,sysdate,sysdate) "); int iCount = 0; int MaxLength = (String.IsNullOrEmpty(ConfigurationManager.AppSettings["MaxTicketLength"].ToString())) ? 1000 : int.Parse(ConfigurationManager.AppSettings["MaxTicketLength"].ToString()); for (int i = 0; i < arrPhone.Length; i++) { string strPhone = arrPhone[i]; //OracleParameter[] parm ={ // new OracleParameter("ID",OracleType.Int32), // new OracleParameter("TICKETCODE",OracleType.VarChar), // new OracleParameter("TICKETUSERCODE",OracleType.VarChar), // new OracleParameter("STATUS",OracleType.VarChar), // new OracleParameter("TICKETAMT",OracleType.Double), // new OracleParameter("PACKAGECODE",OracleType.VarChar), // new OracleParameter("FLAG",OracleType.Int32), // new OracleParameter("USERID",OracleType.VarChar) // }; ////ComFun comFun = new ComFun(); //parm[0].Value = comFun.getMaxIDfromSeq("T_LM_TICKET_USER_SEQ");//ID值 OracleParameter[] parm ={ new OracleParameter("TICKETCODE",OracleType.VarChar), new OracleParameter("TICKETUSERCODE",OracleType.VarChar), new OracleParameter("STATUS",OracleType.VarChar), new OracleParameter("TICKETAMT",OracleType.Double), new OracleParameter("PACKAGECODE",OracleType.VarChar), new OracleParameter("FLAG",OracleType.Int32), new OracleParameter("USERID",OracleType.VarChar) }; parm[0].Value = ticketCode; string strTicketUserCode = getTicketCode_New(13);// getTicketCode(13); if (strTicketUserCode == "") { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + PromptCodeHaveFinish + "');", true); return; } parm[1].Value = strTicketUserCode; parm[2].Value = "0"; parm[3].Value = Convert.ToDouble(ticketAmt); parm[4].Value = strPackageCode; parm[5].Value = 2;//表示手动送券 parm[6].Value = strPhone;//表示手动送券 iCount = iCount + 1; CommandInfo cminfo = new CommandInfo(); cminfo.CommandText = sqlInsert.ToString(); cminfo.Parameters = parm; sqlList.Add(cminfo); try { if (iCount == MaxLength) { DbHelperOra.ExecuteSqlTran(sqlList); sqlList = new List<CommandInfo>(); iCount = 0; } //DbHelperOra.ExecuteSql(sqlInsert.ToString(), parm); //this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + PromptTicketSuccess + "');", true); //this.txtPhoneNumber.Text = ""; } catch { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + PromptTicketFaild + "');", true); } } try { if (iCount > 0) { DbHelperOra.ExecuteSqlTran(sqlList); } //DbHelperOra.ExecuteSql(sqlInsert.ToString(), parm); this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + PromptTicketSuccess + "');", true); this.txtPhoneNumber.Text = ""; CommonEntity _commonEntity = new CommonEntity(); _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage(); _commonEntity.LogMessages.Userid = UserSession.Current.UserAccount; _commonEntity.LogMessages.Username = UserSession.Current.UserDspName; _commonEntity.LogMessages.IpAddress = UserSession.Current.UserIP; _commonEntity.CommonDBEntity = new List<CommonDBEntity>(); CommonDBEntity commonDBEntity = new CommonDBEntity(); commonDBEntity.Event_Type = "发券给指定的用户-保存"; commonDBEntity.Event_ID = strPackageCode; commonDBEntity.Event_Content = String.Format("发券给指定的用户-保存:优惠券包:{0},发送总数:{1},操作人:{2}", strPackageCode, arrPhone.Length, _commonEntity.LogMessages.Userid); commonDBEntity.Event_Result = PromptTicketSuccess; _commonEntity.CommonDBEntity.Add(commonDBEntity); CommonBP.InsertEventHistory(_commonEntity); } catch { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + PromptTicketFaild + "');", true); } } catch { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + PromptTicketFaild + "');", true); } //执行后需要修改页面中的剩余可以生产券的张数 btnSearchRest_Click(null, null); }
private void GenrateForm() { try { if (pnlForm.Controls.Count == 1) { var LINQProfile = db.sp_ProfileListActive(GetPortalID); CommonFunction LToDCon = new CommonFunction(); DataTable dt = LToDCon.LINQToDataTable(LINQProfile); if (dt != null && dt.Rows.Count > 0) { Table tblSageForm = new Table(); tblSageForm.CssClass = "cssClassForm"; tblSageForm.ID = "tblSageForm"; tblSageForm.EnableViewState = true; string parentKey = string.Empty; for (int i = 0; i < dt.Rows.Count; i++) { int ProfileID = Int32.Parse(dt.Rows[i]["ProfileID"].ToString()); TableRow tbrSageRow = new TableRow(); tbrSageRow.ID = "tbrSageRow_" + ProfileID; tbrSageRow.EnableViewState = true; TableCell tcleftSagetd = new TableCell(); tcleftSagetd.ID = "tcleftSagetd_" + ProfileID; tcleftSagetd.CssClass = "cssClassFormtdLleft"; tcleftSagetd.EnableViewState = true; tcleftSagetd.Width = Unit.Percentage(20); Label lblValue = new Label(); lblValue.ID = "lblValue_" + ProfileID; lblValue.Text = dt.Rows[i]["Name"].ToString(); lblValue.ToolTip = dt.Rows[i]["Name"].ToString(); lblValue.EnableViewState = true; lblValue.CssClass = "cssClassFormLabel"; tcleftSagetd.Controls.Add(lblValue); tbrSageRow.Cells.Add(tcleftSagetd); int PropertyTypeID = Int32.Parse(dt.Rows[i]["PropertyTypeID"].ToString()); TableCell tcrightSagetd = new TableCell(); tcrightSagetd.ID = "tcrightSagetd_" + ProfileID; tcrightSagetd.CssClass = "cssClassFormtdRight"; tcrightSagetd.EnableViewState = true; switch (PropertyTypeID) { case 1://TextBox TextBox BDTextBox = new TextBox(); BDTextBox.ID = "BDTextBox_" + ProfileID; BDTextBox.CssClass = "cssClassNormalTextBox"; BDTextBox.EnableViewState = true; int DataType = Int32.Parse(dt.Rows[i]["DataType"].ToString()); switch (DataType) { case 0://String //Adding in Pandel tcrightSagetd.Controls.Add(BDTextBox); break; case 1://Integer BDTextBox.Attributes.Add("OnKeydown", "return NumberKey(event)"); //Adding in Pandel tcrightSagetd.Controls.Add(BDTextBox); break; case 2://Decimal BDTextBox.Attributes.Add("OnKeydown", "return NumberKeyWithDecimal(event)"); //Adding in Pandel tcrightSagetd.Controls.Add(BDTextBox); break; case 3://DateTime ImageButton imb = new ImageButton(); imb.ID = "imb_" + ProfileID; imb.ImageUrl = GetTemplateImageUrl("imgcalendar.png", true); CalendarExtender Cex = new CalendarExtender(); Cex.ID = "Cex_" + ProfileID; Cex.TargetControlID = BDTextBox.ID; Cex.PopupButtonID = imb.ID; Cex.SelectedDate = DateTime.Now; BDTextBox.ToolTip = "DateTime"; BDTextBox.Enabled = false; //Adding in Panel tcrightSagetd.Controls.Add(BDTextBox); tcrightSagetd.Controls.Add(imb); tcrightSagetd.Controls.Add(Cex); break; } bool IsRequred = bool.Parse(dt.Rows[i]["IsRequired"].ToString()); if (IsRequred) { RequiredFieldValidator rfv = new RequiredFieldValidator(); rfv.ID = "rfv_" + ProfileID; rfv.ControlToValidate = BDTextBox.ID; rfv.ErrorMessage = "*"; rfv.ValidationGroup = "UserProfile"; tcrightSagetd.Controls.Add(rfv); } break; case 2://DropDownList DropDownList ddl = new DropDownList(); ddl.ID = "BDTextBox_" + ProfileID; ddl.CssClass = "cssClassDropDown"; //ddl.Width = 200; ddl.EnableViewState = true; //Setting Data Source var LinqProvileValue = db.sp_ProfileValueGetActiveByProfileID(ProfileID, GetPortalID); ddl.DataSource = LinqProvileValue; ddl.DataValueField = "ProfileValueID"; ddl.DataTextField = "Name"; ddl.DataBind(); if (ddl.Items.Count > 0) { ddl.SelectedIndex = 0; } //Adding in Pandel tcrightSagetd.Controls.Add(ddl); break; case 3://CheckBoxList CheckBoxList chbl = new CheckBoxList(); chbl.ID = "BDTextBox_" + ProfileID; chbl.CssClass = "cssClassCheckBox"; chbl.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal; chbl.RepeatColumns = 2; chbl.EnableViewState = true; //Setting Data Source LinqProvileValue = db.sp_ProfileValueGetActiveByProfileID(ProfileID, GetPortalID); chbl.DataSource = LinqProvileValue; chbl.DataValueField = "ProfileValueID"; chbl.DataTextField = "Name"; chbl.DataBind(); if (chbl.Items.Count > 0) { chbl.SelectedIndex = 0; } //Adding in Pandel tcrightSagetd.Controls.Add(chbl); break; case 4://RadioButtonList RadioButtonList rdbl = new RadioButtonList(); rdbl.ID = "BDTextBox_" + ProfileID; rdbl.CssClass = "cssClassRadioButtonList"; rdbl.EnableViewState = true; rdbl.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal; rdbl.RepeatColumns = 2; //Setting Data Source LinqProvileValue = db.sp_ProfileValueGetActiveByProfileID(ProfileID, GetPortalID); rdbl.DataSource = LinqProvileValue; rdbl.DataValueField = "ProfileValueID"; rdbl.DataTextField = "Name"; rdbl.DataBind(); if (rdbl.Items.Count > 0) { rdbl.SelectedIndex = 0; } tcrightSagetd.CssClass = "cssClassButtonListWrapper"; //Adding in Pandel tcrightSagetd.Controls.Add(rdbl); break; case 5://DropDownList DropDownList cddl = new DropDownList(); cddl.ID = "BDTextBox_" + ProfileID; cddl.CssClass = "cssClassDropDown"; //cddl.Width = 200; cddl.EnableViewState = true; cddl.SelectedIndexChanged +=new EventHandler(cddl_SelectedIndexChanged); cddl.AutoPostBack = true; ViewState["cddlID"] = cddl.ID; //Setting Data Source ListManagementDataContext cdb = new ListManagementDataContext(SystemSetting.SageFrameConnectionString); var CLINQ = cdb.sp_GetListEntrybyNameAndID("Country", -1,GetCurrentCultureName); cddl.DataSource = CLINQ; cddl.DataValueField = "Value"; cddl.DataTextField = "Text"; cddl.DataBind(); if (cddl.Items.Count > 0) { cddl.SelectedIndex = 0; parentKey = "Country." + cddl.SelectedItem.Value; } //Adding in Pandel tcrightSagetd.Controls.Add(cddl); break; case 6://DropDownList DropDownList Sddl = new DropDownList(); Sddl.ID = "BDTextBox_" + ProfileID; Sddl.CssClass = "cssClassNormalTextBox"; //Sddl.Width = 200; Sddl.EnableViewState = true; ViewState["SddlID"] = Sddl.ID; //Setting Data Source string listName = "Region"; ListManagementDataContext Sdb = new ListManagementDataContext(SystemSetting.SageFrameConnectionString); var listDetail = Sdb.sp_GetListEntriesByNameParentKeyAndPortalID(listName, parentKey, -1,GetCurrentCultureName); Sddl.DataSource = listDetail; Sddl.DataValueField = "Value"; Sddl.DataTextField = "Text"; Sddl.DataBind(); if (Sddl.Items.Count > 0) { Sddl.SelectedIndex = 0; } ViewState["StateRow"] = tbrSageRow.ID; //Adding in Pandel tcrightSagetd.Controls.Add(Sddl); break; case 7://DropDownList DropDownList TimeZoneddl = new DropDownList(); TimeZoneddl.ID = "BDTextBox_" + ProfileID; TimeZoneddl.CssClass = "cssClassDropDown"; //TimeZoneddl.Width = 200; TimeZoneddl.EnableViewState = true; //Setting Data Source NameValueCollection nvlTimeZone = SageFrame.Localization.Localization.GetTimeZones(((PageBase)this.Page).GetCurrentCultureName); TimeZoneddl.DataSource = nvlTimeZone; TimeZoneddl.DataBind(); if (TimeZoneddl.Items.Count > 0) { TimeZoneddl.SelectedIndex = 0; } //Adding in Pandel tcrightSagetd.Controls.Add(TimeZoneddl); break; case 8://File Upload FileUpload AsyFlu = new FileUpload(); AsyFlu.ID = "BDTextBox_" + ProfileID; AsyFlu.CssClass = "cssClassNormalFileUpload"; AsyFlu.EnableViewState = true; tcrightSagetd.Controls.Add(AsyFlu); System.Web.UI.HtmlControls.HtmlGenericControl gcDiv = new HtmlGenericControl("div"); gcDiv.ID = "BDDiv_" + ProfileID; gcDiv.Attributes.Add("class","cssClassProfileImageWrapper"); gcDiv.EnableViewState = true; gcDiv.Visible = false; Image img = new Image(); img.ID = "Bdimg_" + ProfileID; img.CssClass = "cssClassProfileImage"; img.EnableViewState = true; gcDiv.Controls.Add(img); tcrightSagetd.Controls.Add(gcDiv); break; } tbrSageRow.Cells.Add(tcrightSagetd); tblSageForm.Rows.Add(tbrSageRow); pnlForm.Controls.Add(tblSageForm); } } } } catch (Exception ex) { ProcessException(ex); } }
private void Edit(int EditID) { ClearProfilepropertyForm(); var LINQProfile = db.sp_ProfileGetByProfileID(EditID).SingleOrDefault(); if (LINQProfile != null) { txtCaption.Text = LINQProfile.Name; ddlPropertyType.SelectedIndex = ddlPropertyType.Items.IndexOf(ddlPropertyType.Items.FindByValue(LINQProfile.PropertyTypeID.ToString())); chkIsRequred.Checked = bool.Parse(LINQProfile.IsRequired.ToString()); ddlDataType.SelectedIndex = ddlDataType.Items.IndexOf(ddlDataType.Items.FindByValue(LINQProfile.DataType)); if (LINQProfile.PropertyTypeID != 1 && LINQProfile.PropertyTypeID != 5 && LINQProfile.PropertyTypeID != 6 && LINQProfile.PropertyTypeID != 7 && LINQProfile.PropertyTypeID != 8 && Session["PropertyValueDataTable"] != null) { var LINQPropertyValue = db.sp_ProfileValueGetActiveByProfileID(EditID, GetPortalID); CommonFunction LToDCon = new CommonFunction(); DataTable dtActual = LToDCon.LINQToDataTable(LINQPropertyValue); if (dtActual != null && dtActual.Rows.Count > 0) { DataTable dt = (DataTable)Session["PropertyValueDataTable"]; for (int i = 0; i < dtActual.Rows.Count; i++) { DataRow newrow1 = dt.NewRow(); dt.Rows.Add(newrow1); dt.Rows[dt.Rows.Count - 1]["ProfileValueID"] = dtActual.Rows[i]["ProfileValueID"].ToString(); dt.Rows[dt.Rows.Count - 1]["Name"] = dtActual.Rows[i]["Name"].ToString(); dt.AcceptChanges(); } lstvPropertyValue.DataSource = dt; lstvPropertyValue.DataTextField = "Name"; lstvPropertyValue.DataValueField = "ProfileValueID"; lstvPropertyValue.DataBind(); trListPropertyValue.Style.Add("display", ""); } } else { lstvPropertyValue.DataSource = null; lstvPropertyValue.DataBind(); trListPropertyValue.Style.Add("display", "none"); } } HideAll(); divForm.Style.Add("display", "block"); Session["EditProfileID"] = EditID; }
protected override void OnFirstStart() { base.OnFirstStart(); plot = UIManager.Instance.CreateUI("UIPlayPlot").GetComponent <UIPlayPlot>(); plot.Hide(); plot.onNext = OnPlotNext; match.HideSignal(); match.HideTitle(); match.HideBackButton(); guideTip = UIManager.Instance.CreateUI("GuideTip_3").AddMissingComponent <GuideTip>(); guideTip.transform.localPosition = new Vector3(18, -316, 0); guideTip.firstButtonVisible = false; guideTip.Hide(); foreach (UController.Button btn in match.m_uiController.m_btns) { if (btn.btn != null) { UIEventListener.Get(btn.btn.gameObject).onPress += OnBtnPress; } } match.onTipClick += OnTipClick; ball.onGrab += OnGrab; ball.onCatch += OnCatch; ball.onShoot += OnShoot; ball.onHitGround += OnHitGround; match.mCurScene.mBasket.onGoal += OnGoal; prefabObjFinish = ResourceLoadManager.Instance.LoadPrefab("Prefab/GUI/MatchGuideObjectiveFinish") as GameObject; paneObjective = UIManager.Instance.CreateUI("MatchGuideObjectivePane"); UIGrid gridObj = paneObjective.transform.FindChild("Grid").GetComponent <UIGrid>(); GameObject prefabItem = ResourceLoadManager.Instance.LoadPrefab("Prefab/GUI/MatchGuideObjectiveItem") as GameObject; PractiseStep step = GameSystem.Instance.PractiseStepConfig.GetFirstStep(); readyStepID = step.ID; while (true) { if (step.startObjective.Key != 0) { lastObjID = step.startObjective.Key; GameObject item = CommonFunction.InstantiateObject(prefabItem, gridObj.transform); item.GetComponentInChildren <UILabel>().text = step.startObjective.Value; objectives.Add(step.startObjective.Key, item); } if (step.next == 0) { break; } else { step = GameSystem.Instance.PractiseStepConfig.GetStep(step.next); } } gridObj.Reposition(); }
protected void wzdPasswordRecover_NextButtonClick(object sender, WizardNavigationEventArgs e) { try { MessageTemplateDataContext dbMessageTemplate = new MessageTemplateDataContext(SystemSetting.SageFrameConnectionString); if (txtPassword.Text != null && txtRetypePassword.Text != "" && txtRetypePassword.Text == txtPassword.Text) { if (txtPassword.Text.Length < 4) { ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "PasswordLength"), "", SageMessageType.Alert); e.Cancel = true; } else { if (hdnRecoveryCode.Value != "") { UserManagementDataContext dbUser = new UserManagementDataContext(SystemSetting.SageFrameConnectionString); var sageframeuser = dbUser.sp_GetUsernameByActivationOrRecoveryCode(hdnRecoveryCode.Value, GetPortalID).SingleOrDefault(); if (sageframeuser != null) { MembershipController m = new MembershipController(); UserInfo sageUser = m.GetUserDetails(GetPortalID, sageframeuser.CodeForUsername); //MembershipUser user = Membership.GetUser(sageframeuser.CodeForUsername); string Password, PasswordSalt; PasswordHelper.EnforcePasswordSecurity(m.PasswordFormat, txtPassword.Text, out Password, out PasswordSalt); UserInfo user1 = new UserInfo(sageUser.UserID, Password, PasswordSalt, m.PasswordFormat); m.ChangePassword(user1); //string oldPassword = user.ResetPassword(); //user.ChangePassword(oldPassword, txtPassword.Text); var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_RECOVERED_SUCESSFUL_INFORMATION, GetPortalID).SingleOrDefault(); if (template != null) { ((Literal)WizardStep2.FindControl("litPasswordChangedSuccessful")).Text = template.Body; } var messageTemplates = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_RECOVERED_SUCCESSFUL_EMAIL, GetPortalID); foreach (var messageTemplate in messageTemplates) { MessageTokenDataContext messageTokenDB = new MessageTokenDataContext(SystemSetting.SageFrameConnectionString); var messageTokenValues = messageTokenDB.sp_GetPasswordRecoverySuccessfulTokenValue(sageUser.UserName, GetPortalID); CommonFunction comm = new CommonFunction(); DataTable dtTokenValues = comm.LINQToDataTable(messageTokenValues); string replacedMessageSubject = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtTokenValues); string replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtTokenValues); MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, sageUser.Email, replacedMessageSubject, replacedMessageTemplate, string.Empty, string.Empty); } } else { var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_RECOVERED_SUCESSFUL_INFORMATION, GetPortalID).SingleOrDefault(); if (template != null) { ((Literal)WizardStep2.FindControl("litPasswordChangedSuccessful")).Text = template.Body; } e.Cancel = true; ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "UnknownErrorPleaseTryAgaing"), "", SageMessageType.Alert); } } else { var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_RECOVERED_SUCESSFUL_INFORMATION, GetPortalID).SingleOrDefault(); if (template != null) { ((Literal)WizardStep2.FindControl("litPasswordChangedSuccessful")).Text = template.Body; } e.Cancel = true; ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "UnknownError"), "", SageMessageType.Alert); } } } else { ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "PleaseEnterAllRequiredFields"), "", SageMessageType.Alert); e.Cancel = true; } } catch (Exception ex) { ProcessException(ex); } }
public IActionResult SaveMasterBranch(AddMasterBranchViewModel objAddMasterBranchViewModel) { try { objAddMasterBranchViewModel.EnterById = 1; objAddMasterBranchViewModel.EnterDate = DateTime.Now; objAddMasterBranchViewModel.ModifiedById = 1; objAddMasterBranchViewModel.ModifiedDate = DateTime.Now; if (objAddMasterBranchViewModel.IsActive == null) { objAddMasterBranchViewModel.IsActive = false; } var errors = ModelState.Where(x => x.Value.Errors.Count > 0).Select(x => new { x.Key, x.Value.Errors }).ToArray(); if (ModelState.IsValid) { string endpoint = apiBaseUrl + "MasterBranches"; Task <string> HttpPostResponse = null; if (objAddMasterBranchViewModel.Mode == CommonFunction.Mode.SAVE) { HttpPostResponse = CommonFunction.PostWebAPI(endpoint, objAddMasterBranchViewModel); //Notification Message //Session is used to store object HttpContext.Session.SetObjectAsJson("GlobalMessage", CommonFunction.GlobalMessage(1, 2, 4, "Master Branch", "Master Branch Insert Successfully!", "")); } else if (objAddMasterBranchViewModel.Mode == CommonFunction.Mode.UPDATE) { endpoint = apiBaseUrl + "MasterBranches/" + objAddMasterBranchViewModel.MasterBranchId; HttpPostResponse = CommonFunction.PutWebAPI(endpoint, objAddMasterBranchViewModel); //Notification Message //Session is used to store object HttpContext.Session.SetObjectAsJson("GlobalMessage", CommonFunction.GlobalMessage(1, 2, 4, "Master Branch", "Master Branch Update Successfully!", "")); } if (HttpPostResponse != null) { objAddMasterBranchViewModel = JsonConvert.DeserializeObject <AddMasterBranchViewModel>(HttpPostResponse.Result); _logger.LogInformation("Database Insert/Update: ");//+ JsonConvert.SerializeObject(objAddGenCodeTypeViewModel)); ; return(RedirectToAction("Index")); } else { DropDownFillMethod(); ModelState.Clear(); ModelState.AddModelError(string.Empty, "Server error. Please contact administrator."); return(View("~/Views/Master/MasterBranch/AddMasterBranch.cshtml", objAddMasterBranchViewModel)); } } else { ModelState.Clear(); if (ModelState.IsValid == false) { ModelState.AddModelError(string.Empty, "Validation error. Please contact administrator."); } DropDownFillMethod(); //Return View doesn't make a new requests, it just renders the view return(View("~/Views/Master/MasterBranch/AddMasterBranch.cshtml", objAddMasterBranchViewModel)); } } catch (Exception ex) { string ActionName = this.ControllerContext.RouteData.Values["action"].ToString(); string ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); string ErrorMessage = "Controler:" + ControllerName + " , Action:" + ActionName + " , Exception:" + ex.Message; _logger.LogError(ErrorMessage); return(View("~/Views/Shared/Error.cshtml", CommonFunction.HandleErrorInfo(ex, ActionName, ControllerName))); } return(new EmptyResult()); }
protected void Page_Load(object sender, EventArgs e) { try { comnFunctionObj = new CommonFunction(); lblerror.Visible = false; lblYerror.Visible = false; lblCTarErr.Visible = false; lblDTarErr.Visible = false; lblMerror.Visible = false; lblRerror.Visible = false; lblerr.Visible = false; lblmsg.Visible = false; if (!IsPostBack) { if (Session[clsConstant.TOKEN] == null) { UrlParameterPasser urlWrapper = new UrlParameterPasser(); urlWrapper["pageaccesserr"] = "1"; urlWrapper.Url = "../Logout.aspx"; urlWrapper.PassParameters(); } // if ((((UserDetails)Session[clsConstant.TOKEN]).UserID) != 1031 ) // { if (Utility.CheckAccess("ExcelInterfaceMonth") == false) { pnlInvalid.Visible = true; MainDiv.Visible = false; } if (!Convert.ToBoolean(Session[clsConstant.SESS_VIEWTYPE])) { btnImport.Enabled = false; } drpYear.DataSource = comnFunctionObj.getDropDownList(clsConstant.SP_GET_YEAR, null); drpYear.DataTextField = "DisplayFieldText"; drpYear.DataValueField = "ValueFieldText"; drpYear.DataBind(); string[] removeYear = { "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012" }; for (int i = 0; i < removeYear.Length; i++) { ListItem li = drpYear.Items.FindByText(removeYear[i]); if (li != null) { drpYear.Items.Remove(li); } } btnUpload.Visible = false; } } catch (Exception ex) { logger.Error(ex); } finally { } }
public void HandlePostRegistration(int UserRegistrationType) { switch (UserRegistrationType) { case 0: ForgotPasswordInfo template = UserManagementController.GetMessageTemplateByMessageTemplateTypeID(SystemSetting.USER_RESISTER_SUCESSFUL_INFORMATION_NONE, GetPortalID); if (template != null) { USER_RESISTER_SUCESSFUL_INFORMATION.Text = template.Body; } break; case 1: template = UserManagementController.GetMessageTemplateByMessageTemplateTypeID(SystemSetting.USER_RESISTER_SUCESSFUL_INFORMATION_PRIVATE, GetPortalID); if (template != null) { USER_RESISTER_SUCESSFUL_INFORMATION.Text = template.Body; } this.divRegistration.Visible = true; this.divRegConfirm.Visible = true; this.divRegister.Visible = false; break; case 3: template = UserManagementController.GetMessageTemplateByMessageTemplateTypeID(SystemSetting.USER_RESISTER_SUCESSFUL_INFORMATION_VERIFIED, GetPortalID); if (template != null) { USER_RESISTER_SUCESSFUL_INFORMATION.Text = template.Body; } List<ForgotPasswordInfo> objFpwd = UserManagementController.GetMessageTemplateListByMessageTemplateTypeID(SystemSetting.ACCOUNT_ACTIVATION_EMAIL, GetPortalID); foreach (ForgotPasswordInfo messageTemplate in objFpwd) { CommonFunction comm = new CommonFunction(); DataTable dtActivationTokenValues = UserManagementController.GetActivationTokenValue(UserName.Text, GetPortalID); string replaceMessageSubject = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtActivationTokenValues); string replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, UserName.Text, GetPortalID); // string replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtActivationTokenValues); MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, Email.Text, replaceMessageSubject, replacedMessageTemplate, string.Empty, string.Empty); } // CheckDivVisibility(false, true); this.divRegistration.Visible = true; this.divRegConfirm.Visible = true; this.divRegister.Visible = false; break; case 2: template = UserManagementController.GetMessageTemplateByMessageTemplateTypeID(SystemSetting.USER_RESISTER_SUCESSFUL_INFORMATION_PUBLIC, GetPortalID); if (template != null) { USER_RESISTER_SUCESSFUL_INFORMATION.Text = template.Body; } LogInPublicModeRegistration(); break; } }
public IActionResult Index() { try { IndexMasterBranchViewModel objIndexMasterBranchViewModel = new IndexMasterBranchViewModel(); IEnumerable <MasterBranchViewModel> objMasterBranchViewModelList = null; string endpoint = apiBaseUrl + "MasterBranches"; Task <string> HttpGetResponse = CommonFunction.GetWebAPI(endpoint); if (HttpGetResponse != null) { objMasterBranchViewModelList = JsonConvert.DeserializeObject <IEnumerable <MasterBranchViewModel> >(HttpGetResponse.Result).ToList(); } else { objMasterBranchViewModelList = Enumerable.Empty <MasterBranchViewModel>().ToList(); ModelState.AddModelError(string.Empty, "Server error. Please contact administrator."); } objIndexMasterBranchViewModel.MasterBranchList = objMasterBranchViewModelList.OrderBy(a => a.BranchTitle).ToList(); //############# Profile Maping ################### CPanelManager.ViewModels.Account.ValidateAccountViewModel objValidateAccountViewModel = CommonFunction.ActionResultAuthentication(HttpContext, "/MasterBranch/Index"); if (objValidateAccountViewModel != null) { objIndexMasterBranchViewModel.IsSelect = objValidateAccountViewModel.IsSelect; objIndexMasterBranchViewModel.IsInsert = objValidateAccountViewModel.IsInsert; objIndexMasterBranchViewModel.IsUpdate = objValidateAccountViewModel.IsUpdate; objIndexMasterBranchViewModel.IsDelete = objValidateAccountViewModel.IsDelete; } //############# Profile Maping End ################### //Return View doesn't make a new requests, it just renders the view return(View("~/Views/Master/MasterBranch/Index.cshtml", objIndexMasterBranchViewModel)); } catch (Exception ex) { string ActionName = this.ControllerContext.RouteData.Values["action"].ToString(); string ControllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); string ErrorMessage = "Controler:" + ControllerName + " , Action:" + ActionName + " , Exception:" + ex.Message; _logger.LogError(ErrorMessage); return(View("~/Views/Shared/Error.cshtml", CommonFunction.HandleErrorInfo(ex, ActionName, ControllerName))); } return(new EmptyResult()); }
//增加到数据库中 protected void btnAdd_Click(object sender, EventArgs e) { StringBuilder sql = new StringBuilder(); //Oracle sql 语法 sql.AppendLine("INSERT INTO T_LM_TICKET_RULE(ID,TICKETRULECODE,CREATETIME,ORDAMT,STARTTIME,ENDTIME,STARTDATE,ENDDATE,HOTELID,CITYID,USEFLG,TICKETRULEDESC,TICKETRULENAME,CLIENTCODE,USECODE,HOTELNAME,USERGROUPID,PRICE_CODE) VALUES ( "); sql.AppendLine(":ID,:TICKETRULECODE,:CREATETIME,:ORDAMT,:STARTTIME,:ENDTIME,:STARTDATE,:ENDDATE,:HOTELID,:CITYID,:USEFLG,:TICKETRULEDESC,:TICKETRULENAME,:CLIENTCODE,:USECODE,:HOTELNAME,:USERGROUPID,:PRICECODE) "); OracleParameter[] parm ={ new OracleParameter("ID",OracleType.Int32), new OracleParameter("TICKETRULECODE",OracleType.VarChar), new OracleParameter("CREATETIME",OracleType.DateTime), new OracleParameter("ORDAMT",OracleType.Int32), new OracleParameter("STARTTIME",OracleType.VarChar), new OracleParameter("ENDTIME",OracleType.VarChar), new OracleParameter("STARTDATE",OracleType.VarChar), new OracleParameter("ENDDATE",OracleType.VarChar), new OracleParameter("HOTELID",OracleType.VarChar), new OracleParameter("CITYID",OracleType.VarChar), new OracleParameter("USEFLG",OracleType.VarChar), new OracleParameter("TICKETRULEDESC",OracleType.NVarChar), new OracleParameter("TICKETRULENAME",OracleType.NVarChar), new OracleParameter("CLIENTCODE",OracleType.NVarChar),//销售渠道 new OracleParameter("USECODE",OracleType.NVarChar), new OracleParameter("HOTELNAME",OracleType.NVarChar), new OracleParameter("USERGROUPID",OracleType.VarChar),//用户组 new OracleParameter("PRICECODE",OracleType.VarChar), }; string strTicketCode = "10000"; string strTicketName = this.txtRuleName.Text;//规则名称 string strFromDate = this.fromDate.Value; string strEndDate = this.endDate.Value; string strStartTime = this.txtStartTime.Text; string strEndTime = this.txtEndTime.Text; string strOrdAmt = this.txtOrdAmt.Text; if (strOrdAmt == "") { strOrdAmt = "0"; } string strHotelID = this.txthotelid.Value; string strCityID = this.cityid.SelectedValue; string strRuleDesc = this.txtRuleDesc.Text; string strHotelName = this.txtHotelName.Value; string useGroup = ""; //使用用户组 for (int i = 0; i < LBUserGroup.Items.Count; i++) { if (LBUserGroup.Items[i].Selected == true) { useGroup = useGroup + LBUserGroup.Items[i].Value + ","; } } useGroup = useGroup.Trim().Trim(','); string useCode = "";//使用平台 for (int i = 0; i < LBUsePlatForm.Items.Count; i++) { if (LBUsePlatForm.Items[i].Selected == true) { useCode = useCode + LBUsePlatForm.Items[i].Value + ","; } } useCode = useCode.Trim().Trim(','); //销售渠道 string saleChannel = "";//销售渠道 for (int i = 0; i < LBSaleChannel.Items.Count; i++) { if (LBSaleChannel.Items[i].Selected == true) { saleChannel = saleChannel + LBSaleChannel.Items[i].Value + ","; } } saleChannel = saleChannel.Trim().Trim(','); //价格代码 string priceCode = "";//价格代码 for (int i = 0; i < LBPriceCode.Items.Count; i++) { if (LBPriceCode.Items[i].Selected == true) { priceCode = priceCode + LBPriceCode.Items[i].Value + ","; } } priceCode = priceCode.Trim().Trim(','); CommonFunction comFun = new CommonFunction(); parm[0].Value = comFun.getMaxIDfromSeq("T_LM_TICKET_RULE_SEQ"); int ticketrulecode = DbHelperOra.GetMaxID("TICKETRULECODE", "T_LM_TICKET_RULE", false); if (ticketrulecode == 1) { strTicketCode = "10000"; } else { strTicketCode = ticketrulecode.ToString(); } parm[1].Value = strTicketCode; parm[2].Value = System.DateTime.Now; parm[3].Value = strOrdAmt; parm[4].Value = strStartTime; parm[5].Value = strEndTime; parm[6].Value = strFromDate; parm[7].Value = strEndDate; parm[8].Value = strHotelID; parm[9].Value = strCityID; parm[10].Value = "1"; parm[11].Value = strRuleDesc; parm[12].Value = strTicketName; parm[13].Value = saleChannel; parm[14].Value = useCode; parm[15].Value = strHotelName; parm[16].Value = useGroup; parm[17].Value = priceCode; try { DbHelperOra.ExecuteSql(sql.ToString(), parm); //clear the control value clearValue(); //重新绑定Gridview BindGridView(); // this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + AddRuleSuccess + "');", true); this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "invokeOpen();", true); } catch (Exception ex) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + AddRuleFaild + "');", true); //ex.ToString(); } }
public JsonResult TransferD72() { MSGReturnModel result = new MSGReturnModel(); try { DateTime startTime = DateTime.Now; #region 抓Excel檔案 轉成 model // Excel 檔案位置 string projectFile = Server.MapPath("~/" + SetFile.FileUploads); string fileName = string.Empty; if (Cache.IsSet(CacheList.D72ExcelName)) { fileName = (string)Cache.Get(CacheList.D72ExcelName); //從Cache 抓資料 } if (fileName.IsNullOrWhiteSpace()) { result.RETURN_FLAG = false; result.DESCRIPTION = Message_Type.time_Out.GetDescription(); return(Json(result)); } string path = Path.Combine(projectFile, fileName); List <D72ViewModel> dataModel = new List <D72ViewModel>(); string errorMessage = string.Empty; using (FileStream stream = System.IO.File.Open(path, FileMode.Open, FileAccess.Read)) { //Excel轉成 Exhibit10Model string pathType = path.Split('.')[1]; //抓副檔名 var data = D7Repository.GetD72Excel(pathType, stream); dataModel = data.Item2; errorMessage = data.Item1; } if (!errorMessage.IsNullOrWhiteSpace()) { result.RETURN_FLAG = false; result.DESCRIPTION = errorMessage; return(Json(result)); } #endregion 抓Excel檔案 轉成 model #region txtlog 檔案名稱 string txtpath = SetFile.D72TransferTxtLog; //預設txt名稱 #endregion txtlog 檔案名稱 #region save SMF_Group(D72) MSGReturnModel resultD72 = D7Repository.SaveD72(dataModel); //save to DB CommonFunction.saveLog(Table_Type.D72, fileName, SetFile.ProgramName, resultD72.RETURN_FLAG, Debt_Type.B.ToString(), startTime, DateTime.Now, AccountController.CurrentUserInfo.Name); //寫sql Log TxtLog.txtLog(Table_Type.D72, resultD72.RETURN_FLAG, startTime, txtLocation(txtpath)); //寫txt Log #endregion save SMF_Group(D72) result.RETURN_FLAG = resultD72.RETURN_FLAG; result.DESCRIPTION = Message_Type.save_Success.GetDescription(Table_Type.D72.ToString()); if (!result.RETURN_FLAG) { result.DESCRIPTION = Message_Type.save_Fail .GetDescription(Table_Type.D72.ToString(), resultD72.DESCRIPTION); } } catch (Exception ex) { result.RETURN_FLAG = false; result.DESCRIPTION = ex.exceptionMessage(); } return(Json(result)); }
protected void btnSave_Click(object sender, EventArgs e) { string packageName = this.txtPackageName.Text.Replace("'", ""); string allAmount = this.txtAllAmount.Value.Replace("'", ""); ;//总金额 //string fromDate = this.FromDate.Text.Replace("'", ""); //string endDate = this.EndDate.Text.Replace("'", ""); string fromDate = this.FromDate.Value.Replace("'", ""); string endDate = this.EndDate.Value.Replace("'", ""); string userCount = this.txtUserCount.Text.Replace("'", ""); //可被用户领用数,如果为空,则记录为0 if (string.IsNullOrEmpty(userCount)) { userCount = "0"; } string userRepCount = this.txtUserRepCount.Text.Replace("'", ""); //可被用户领用数,如果为空,则记录为1 if (string.IsNullOrEmpty(userRepCount)) { userRepCount = "1"; } string saleChannel = ""; //发放渠道 for (int i = 0; i < LBSaleChanel.Items.Count; i++) { if (LBSaleChanel.Items[i].Selected == true) { saleChannel = saleChannel + LBSaleChanel.Items[i].Value + ","; } } saleChannel = saleChannel.Trim().Trim(',').Replace("'", ""); //string useClient = this.LBUseFlatForm.SelectedValue;//使用平台 string userGroup = ""; //领用用户组 for (int i = 0; i < LBUserGroup.Items.Count; i++) { if (LBUserGroup.Items[i].Selected == true) { userGroup = userGroup + LBUserGroup.Items[i].Value + ","; } } userGroup = userGroup.Trim().Trim(',').Replace("'", ""); string useCode = "";//用户平台 for (int i = 0; i < LBUsePlatForm.Items.Count; i++) { if (LBUsePlatForm.Items[i].Selected == true) { useCode = useCode + LBUsePlatForm.Items[i].Value + ","; } } useCode = useCode.Trim().Trim(',').Replace("'", ""); string cityID = this.txtCityID.Value;//城市ID //通过变量的方式,加入数据表中 StringBuilder sql = new StringBuilder(); CommonFunction comFun = new CommonFunction(); //string strPackageCode = comFun.GetRandNumString(10);//一个10位的随机数 string strPackageCode = string.Empty; if (!chkCustomNumber.Checked) { strPackageCode = getPackageCode(10);//一个10位的随机数 if (strPackageCode == "") { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('领用券Code的位数已经使用完,不能生成新的Code了!');changeRemainValue();", true); return; } } else { if (!chkCustomIsNum(txtCustomNumber.Text.Trim())) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('自定义优惠券号码必须为10位数字!');changeRemainValue();", true); return; } if (!chkCutomerNum(txtCustomNumber.Text)) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('礼包号码与历史重复,请返回修改!');changeRemainValue()", true); return; } else { strPackageCode = txtCustomNumber.Text.Trim(); } } string packageType = this.hidPackageType.Value;//城市ID //=============主表========================= string status = "1"; int packageID = comFun.getMaxIDfromSeq("T_LM_TICKET_PACKAGE_SEQ"); sql.AppendLine("INSERT INTO T_LM_TICKET_PACKAGE(ID,STATUS,PACKAGENAME,PACKAGECODE,STARTDATE,ENDDATE,USERCNT,CREATETIME,AMOUNT,CLIENTCODE,USERGROUPID,USECODE,CITYID, SINGLE_USERCNT, PACKAGETYPE) VALUES "); sql.AppendLine("(" + packageID + ",'" + status + "','" + packageName + "','" + strPackageCode + "','" + fromDate + "','" + endDate + "'," + userCount + ",to_date( '" + System.DateTime.Now + "' , 'YYYY-MM-DD HH24:MI:SS' )," + allAmount + ",'" + saleChannel + "','" + userGroup + "','" + useCode + "','" + cityID + "'," + userRepCount + ",'"+ packageType + "') "); //to_date ( '2007-12-20 18:31:34' , 'YYYY-MM-DD HH24:MI:SS' ) //循环执行 List<String> list = new List<string>(); list.Add(sql.ToString()); //==================把子表信息加入到表 T_LM_TICKET string[] lblNumber = Request.Form.GetValues("lblNumber"); string[] lblAmount = Request.Form.GetValues("lblAmount"); int ticketCodeFlag = 0; StringBuilder sql_ticket = new StringBuilder(); for (int i = 0; i < lblNumber.Length; i++) { sql_ticket.AppendLine("INSERT INTO T_LM_TICKET(ID,STATUS,TICKETCODE,TICKETAMT,CREATETIME,PACKAGECODE,TICKETCNT) VALUES "); int intGetID = comFun.getMaxIDfromSeq("T_LM_TICKET_SEQ");//ID的值 string strStatus = "1"; //string strTicketCode = comFun.GetRandNumString(13); //ticket的code,10位数的随机数 string strTicketCode = getTicketCode(13); //ticket的code,10位数的随机数 if (strTicketCode == "") { ticketCodeFlag = 1; break; } DateTime CREATETIME = System.DateTime.Now; string IntTicketCnt = lblNumber[i].Trim().ToString(); string IntTicketAmt = lblAmount[i].Trim().ToString(); //加入值每个字段的值 sql_ticket.AppendLine("( " + intGetID + ",'" + strStatus + "','" + strTicketCode + "'," + IntTicketAmt + ",to_date('" + CREATETIME + "' , 'YYYY-MM-DD HH24:MI:SS'),'" + strPackageCode + "'," + IntTicketCnt + ")"); //add to list list.Add(sql_ticket.ToString()); sql_ticket.Clear(); } if (ticketCodeFlag == 1)//表示在产生Ticket code的时候,已经没法产生可用的Ticket Code了。 { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('内含Ticket Code的位数已经使用完,无法生成新的Code了!');changeRemainValue()", true); return; } //================================================= try { DbHelperOra.ExecuteSqlTran(list); //this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('领用券新增成功!');", true); this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "invokeOpen();", true); //清除页面内容 clearValue(); //bind gridview BindGridView(); } catch (Exception ex) { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('领用券新增失败!');changeRemainValue()", true); //ex.ToString(); } }
/// 返回业务分类 /// <summary> /// 返回业务分类 /// </summary> /// <param name="businesstype"></param> /// <returns></returns> public string GetBusinessType(string businesstype) { return(BLL.Util.GetMutilEnumDataNames(CommonFunction.ObjectToInteger(businesstype), typeof(BusinessTypeEnum))); }
private void tlbSearch_Click(object sender, RoutedEventArgs e) { Mouse.OverrideCursor = Cursors.Wait; try { sSanPham = ""; sIDCum = ""; foreach (RadTreeViewItem item in tvwTree.CheckedItems) { ///Cấu trúc của Tag: GiaTri#Level#LoaiTree ( VD: MaSP001#2#SAN_PHAM hoặc CUM001#3#DON_VI) string sTag = item.Tag.ToString(); int i1 = sTag.IndexOf("#"); int i2 = sTag.LastIndexOf("#"); string sValue = sTag.Substring(0, i1); int iLevel = Convert.ToInt32(sTag.Substring(i1 + 1, i2 - i1 - 1)); string sLoaiTree = sTag.Substring(i2 + 1); if (sLoaiTree.Equals("SAN_PHAM")) { if (iLevel == 2) { sSanPham = sSanPham + "''" + sValue + "'',"; } } if (sLoaiTree.Equals("DON_VI")) { if (iLevel == 3) { sIDCum = sIDCum + "''" + sValue + "'',"; } } } if (sSanPham.Length > 0) { sSanPham = sSanPham.Substring(0, sSanPham.Length - 1); } if (sIDCum.Length > 0) { sIDCum = sIDCum.Substring(0, sIDCum.Length - 1); } //if (itemSanPham.CheckState == System.Windows.Automation.ToggleState.On) //{ // sSanPham = "%"; //} if (itemDonVi.CheckState == System.Windows.Automation.ToggleState.On) { sIDCum = "%"; } if (sSanPham.Equals("")) { sSanPham = "''''"; } if (sIDCum.Equals("")) { sIDCum = "''''"; } LoadGrid(); } catch (Exception ex) { CommonFunction.ThongBaoLoi(ex); LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); } finally { Mouse.OverrideCursor = Cursors.Arrow; } }
public SystemHardware() { hardwares = HardwareInfoList.ReadSetting(); HardwareInfoList.SaveSetting(hardwares); CommonFunction.CheckAndRestore(CommonFunction.DefaultConfigPath + "MotionConfig0.cfg", CommonFunction.DefaultBackupConfigPath + "MotionConfig0.cfg"); CommonFunction.CheckAndRestore(CommonFunction.DefaultConfigPath + "MotionConfig1.cfg", CommonFunction.DefaultBackupConfigPath + "MotionConfig1.cfg"); CommonFunction.CheckAndRestore(CommonFunction.DefaultConfigPath + "MotionConfig2.cfg", CommonFunction.DefaultBackupConfigPath + "MotionConfig2.cfg"); CommonFunction.CheckAndRestore(CommonFunction.DefaultConfigPath + "MotionConfig3.cfg", CommonFunction.DefaultBackupConfigPath + "MotionConfig3.cfg"); CommonFunction.CheckAndRestore(CommonFunction.DefaultConfigPath + "ExtMdl1.cfg", CommonFunction.DefaultBackupConfigPath + "ExtMdl1.cfg"); m_MotionCards[0] = new GTS_CAxisCard(new GTS_CardArg(0, "GTS-400#1", GTS_CardType.GTS400PG), CommonFunction.DefaultConfigPath + "MotionConfig0.cfg"); m_MotionCards[1] = new GTS_CAxisCard(new GTS_CardArg(1, "GTS-400#2", GTS_CardType.GTS400PG), CommonFunction.DefaultConfigPath + "MotionConfig1.cfg"); m_MotionCards[2] = new GTS_CAxisCard(new GTS_CardArg(2, "GTS-400#3", GTS_CardType.GTS400PG), CommonFunction.DefaultConfigPath + "MotionConfig2.cfg"); m_MotionCards[3] = new GTS_CAxisCard(new GTS_CardArg(3, "GTS-400#4", GTS_CardType.GTS400PG), CommonFunction.DefaultConfigPath + "MotionConfig3.cfg"); m_IOSysList[0] = ((GTS_CAxisCard)m_MotionCards[0]).IOSys; m_IOSysList[1] = ((GTS_CAxisCard)m_MotionCards[1]).IOSys; m_IOSysList[2] = ((GTS_CAxisCard)m_MotionCards[2]).IOSys; m_IOSysList[3] = ((GTS_CAxisCard)m_MotionCards[3]).IOSys; m_IOSysList[4] = new GoogleExtIOSystem("GoogleExt", 4, 64, 64, CommonFunction.DefaultConfigPath + "ExtMdl1.cfg"); for (int i = 0; i < m_SerialPortControlList.Length; i++) { m_SerialPortControlList[i] = new SerialPortControl(m_SystemSerialPorts, ((HardwareSerialPortName)i).ToString()); m_SerialPortDataList[i] = new SerialPortData(m_SerialPortControlList[i]); } BaseIOPort temp; for (int i = 0; i < 64; i++) { temp = m_IOSysList[i / 16].GetInPort(i % 16); temp.PortName = "In" + ((HardwareInportName)i).ToString(); temp.PortCode = "EXI" + i.ToString("000"); if (temp.ReadSetting()) { temp.WriteSetting(); } temp = m_IOSysList[i / 16].GetOutPort(i % 16); temp.PortName = "Out" + ((HardwareOutportName)i).ToString(); temp.PortCode = "EXO" + i.ToString("000"); if (temp.ReadSetting()) { temp.WriteSetting(); } temp.SetOutput(false); } for (int i = 0; i < 64; i++) { temp = m_IOSysList[4].GetInPort(i); temp.PortName = "In" + ((HardwareInportName)(i + 64)).ToString(); temp.PortCode = "EXI" + (i + 64).ToString("000"); if (temp.ReadSetting()) { temp.WriteSetting(); } temp = m_IOSysList[4].GetOutPort(i); temp.PortName = "Out" + ((HardwareOutportName)(i + 64)).ToString(); temp.PortCode = "EXO" + (i + 64).ToString("000"); if (temp.ReadSetting()) { temp.WriteSetting(); } temp.SetOutput(false); } }
protected void wzdForgetPassword_NextButtonClick(object sender, WizardNavigationEventArgs e) { try { if (txtEmail.Text != "" && txtUsername.Text != "") { MembershipUserCollection userCollection = Membership.FindUsersByEmail(txtEmail.Text); if (userCollection.Count > 0) { MembershipUser user = userCollection[txtUsername.Text]; if (user != null) { if (user.IsApproved == true) { var template = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_FORGET_USERNAME_PASSWORD_MATCH, GetPortalID).SingleOrDefault(); if (template != null) { ((Literal)WizardStep2.FindControl("litInfoEmailFinish")).Text = template.Body; } var messageTemplates = dbMessageTemplate.sp_MessageTemplateByMessageTemplateTypeID(SystemSetting.PASSWORD_CHANGE_REQUEST_EMAIL, GetPortalID); foreach (var messageTemplate in messageTemplates) { MessageTokenDataContext messageTokenDB = new MessageTokenDataContext(SystemSetting.SageFrameConnectionString); var messageTokenValues = messageTokenDB.sp_GetPasswordRecoveryTokenValue(txtUsername.Text, GetPortalID); CommonFunction comm = new CommonFunction(); DataTable dtTokenValues = comm.LINQToDataTable(messageTokenValues); string replaceMessageSubject = MessageToken.ReplaceAllMessageToken(messageTemplate.Subject, dtTokenValues); string replacedMessageTemplate = MessageToken.ReplaceAllMessageToken(messageTemplate.Body, dtTokenValues); try { MailHelper.SendMailNoAttachment(messageTemplate.MailFrom, txtEmail.Text, replaceMessageSubject, replacedMessageTemplate, string.Empty, string.Empty); } catch (Exception) { //divForgotPwd.Visible = false; ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "SecureConnectionFPError"), "", SageMessageType.Alert); e.Cancel = true; } } } else { ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "UsernameNotActivated"), "", SageMessageType.Alert); e.Cancel = true; } } else { ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "UsernameOrEmailAddressDoesnotMatched"), "", SageMessageType.Alert); e.Cancel = true; } } else { ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "UsernameOrEmailAddressDoesnotMatchedAgain"), "", SageMessageType.Alert); e.Cancel = true; } } else { e.Cancel = true; ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("PasswordRecovery", "PleaseEnterAllTheRequiredFields"), "", SageMessageType.Alert); } } catch (Exception ex) { ProcessException(ex); } }
public static TRetunrLoadData LoadData(CSearch itemSearch) { TRetunrLoadData result = new TRetunrLoadData(); if (!UserAcc.UserExpired()) { PTTGC_EPIEntities epi = new PTTGC_EPIEntities(); List <Data_Perm> lstPerm = new List <Data_Perm>(); int nRole = UserAcc.GetObjUser().nRoleID; int nUserID = UserAcc.GetObjUser().nUserID; string sSearch = CommonFunction.ReplaceInjection(itemSearch.sSearch.Trims().ToLower()); int nFacID = 0; if (nRole == 3 || nRole == 4) { #region L1, L2 string sCondition = ""; if (itemSearch.nGroupIndID.HasValue) { sCondition += " AND f.IDIndicator=" + itemSearch.nGroupIndID.Value; } if (!string.IsNullOrEmpty(sSearch)) { sCondition += " AND LOWER(mF.Name) LIKE '%" + sSearch + "%'"; } if (itemSearch.nStatus.HasValue) { sCondition += " AND d.nHistoryStatusID =" + itemSearch.nStatus; } if (!string.IsNullOrEmpty(itemSearch.sFacID)) { sCondition += " AND p.IDFac = " + itemSearch.sFacID; } #region SQL L1, L2 string _Query = "SELECT" + " p.IDFac AS nFacilities" + " ,p.IDIndicator AS nIndicator" + " ,p.L1 AS nL1" + " ,p.L2 AS nL2 " + " ,f.FormID AS nFormID" + " ,f.sYear AS sYear" + " ,d.nMonth AS nMonth" + " ,d.nHistoryStatusID AS nStatus" + " ,d.nReportID AS nReportID" + " ,mF.Name AS sNameFacilities" + " ,mI.Indicator AS sNameIndicator" + " ,CASE " + " WHEN d.nMonth = 1 THEN 'Jan.'" + " WHEN d.nMonth = 2 THEN 'Feb.'" + " WHEN d.nMonth = 3 THEN 'Mar.'" + " WHEN d.nMonth = 4 THEN 'Apr.'" + " WHEN d.nMonth = 5 THEN 'May'" + " WHEN d.nMonth = 6 THEN 'Jun.'" + " WHEN d.nMonth = 7 THEN 'Jul.'" + " WHEN d.nMonth = 8 THEN 'Aug.'" + " WHEN d.nMonth = 9 THEN 'Sep.'" + " WHEN d.nMonth = 10 THEN 'Oct.'" + " WHEN d.nMonth = 11 THEN 'Nov.'" + " WHEN d.nMonth = 12 THEN 'Dec.'" + " ELSE 'Dec.'" + " END sMonth" + " ,d.nHistoryStatusID AS nStatus" + " ,sf.sStatusName AS sStatus" + " ,d.dAction" + " FROM mTWorkFlow p" + " INNER JOIN TEPI_Forms f ON f.FacilityID = p.IDFac AND f.IDIndicator = p.IDIndicator" + " INNER JOIN TEPI_Workflow d ON d.FormID = f.FormID" + " INNER JOIN mTFacility mF ON mF.ID = p.IDFac AND mF.cDel = 'N' AND mF.nLevel = 2" + " INNER JOIN mTIndicator mI ON mI.ID = p.IDIndicator" + " INNER JOIN TStatus_Workflow sf ON sf.nStatustID = d.nHistoryStatusID" + " WHERE p.cDel = 'N' AND (p.L1 = " + nUserID + " OR p.L2 = " + nUserID + ") AND f.sYear=" + itemSearch.nYear + sCondition + " ORDER BY d.dAction DESC "; //f.sYear,d.nMonth,mF.Name,mI.Indicator #endregion lstPerm = epi.Database.SqlQuery <Data_Perm>(_Query).ToList(); int[] lstStatusL1 = { 1 }; int[] lstStatusL2 = { 4, 2 }; int[] lstStatusL0 = { 0, 8, 9, 24, 18 }; if (lstPerm.Any()) { if (nRole == 3)//L1 { lstPerm = lstPerm.Where(w => w.nL1 == nUserID && lstStatusL1.Contains(w.nStatus)).OrderByDescending(o => o.dAction).ThenBy(o => o.sYear).ThenBy(o => o.nMonth).ThenBy(o => o.sNameFacilities).ThenBy(o => o.sNameIndicator).ToList(); } else if (nRole == 4)//L2 { lstPerm = lstPerm.Where(w => w.nL2 == nUserID && lstStatusL2.Contains(w.nStatus)).OrderByDescending(o => o.dAction).ThenBy(o => o.sYear).ThenBy(o => o.nMonth).ThenBy(o => o.sNameFacilities).ThenBy(o => o.sNameIndicator).ToList(); } } #endregion } else if (nRole == 2) { #region L0 Func <int, string> GetMonthName = (month) => { string sMonthName = ""; if (month >= 1 && month <= 12) { sMonthName = new DateTime(DateTime.Now.Year, month, 1).ToString("MMM", new CultureInfo("en-US")); } else { sMonthName = month + ""; } return(sMonthName); }; string sCondition = ""; if (itemSearch.nGroupIndID.HasValue) { sCondition += " AND TUF.nGroupIndicatorID=" + itemSearch.nGroupIndID.Value; } if (!string.IsNullOrEmpty(itemSearch.sFacID)) { nFacID = int.Parse(itemSearch.sFacID); } //if (itemSearch.nStatus.HasValue) //{ // sCondition += " AND TEPIWF.nHistoryStatusID =" + itemSearch.nStatus; //} #region sql string sqlL0 = @"SELECT TF.ID 'nFacilityID',TF.OperationtypeID,TF.Name 'sFacilityName',TIND.ID 'nIndID',TIND.Indicator 'sIndicator' ,TEPI.FormID,TEPIWF.nReportID,TEPIWF.nMonth,TEPIWF.nHistoryStatusID ,TSWF.sStatusName,TEPIWF.dAction FROM mTUser_FacilityPermission TUF INNER JOIN mTFacility TF ON TUF.nFacilityID=TF.ID AND TF.nLevel=2 INNER JOIN mTFacility TFH ON TF.nHeaderID=TFH.ID AND TFH.nLevel=1 INNER JOIN mTIndicator TIND ON TUF.nGroupIndicatorID=TIND.ID LEFT JOIN TEPI_Forms TEPI ON TUF.nGroupIndicatorID=TEPI.IDIndicator AND TF.ID=TEPI.FacilityID AND TF.OperationTypeID=TEPI.OperationTypeID AND TEPI.sYear='" + itemSearch.nYear + @"' LEFT JOIN TEPI_Workflow TEPIWF ON TEPI.FormID=TEPIWF.FormID LEFT JOIN TStatus_Workflow TSWF ON ISNULL(TEPIWF.nHistoryStatusID,0)=TSWF.nStatustID WHERE TUF.nUserID=" + nUserID + " AND TUF.nRoleID=" + nRole + @" AND TUF.nPermission=2 AND TF.cDel='N' AND TF.cActive='Y' AND TFH.cDel='N' AND TFH.cActive='Y' AND (TEPIWF.nHistoryStatusID IS NULL OR TEPIWF.nHistoryStatusID IN (0,8,9,24,18)) " + sCondition + @" order by TEPIWF.dAction DESC"; #endregion DataTable dt = new DataTable(); dt = CommonFunction.Get_Data(SystemFunction.strConnect, sqlL0); var Query = dt.AsEnumerable().Select(s => new { nFacilityID = s.Field <int>("nFacilityID"), OperationtypeID = s.Field <int>("OperationtypeID"), sFacilityName = s.Field <string>("sFacilityName"), nIndID = s.Field <int>("nIndID"), sIndicator = s.Field <string>("sIndicator"), FormID = s.Field <int?>("FormID"), nReportID = s.Field <int?>("nReportID"), nMonth = s.Field <int?>("nMonth"), nStatusID = s.Field <int?>("nHistoryStatusID"), sStatusName = s.Field <string>("sStatusName"), dAction = s.Field <DateTime?>("dAction"), }); lstPerm = Query.Where(w => w.FormID.HasValue).Select(s => new Data_Perm { nFacilities = s.nFacilityID, nIndicator = s.nIndID, sYear = itemSearch.nYear + "", nFormID = s.FormID ?? 0, nMonth = s.nMonth ?? 0, sMonth = GetMonthName(s.nMonth ?? 0), nReportID = s.nReportID ?? 0, sNameFacilities = s.sFacilityName, sNameIndicator = s.sIndicator, nStatus = s.nStatusID ?? 0, sStatus = s.sStatusName, nOperationtypeID = s.OperationtypeID, dAction = s.dAction }).ToList(); var QueryNoAction = Query.Where(w => !w.FormID.HasValue).ToList(); foreach (var item in QueryNoAction) { for (var i = 1; i <= 12; i++) { lstPerm.Add(new Data_Perm { nFacilities = item.nFacilityID, nOperationtypeID = item.OperationtypeID, nIndicator = item.nIndID, sYear = itemSearch.nYear + "", nFormID = item.FormID ?? 0, nMonth = i, sMonth = GetMonthName(i), nReportID = 0, sNameFacilities = item.sFacilityName, sNameIndicator = item.sIndicator, nStatus = -1, sStatus = "No Action", dAction = null }); } } lstPerm = lstPerm.Where(w => (itemSearch.nStatus != null ? w.nStatus == itemSearch.nStatus : true) && (!string.IsNullOrEmpty(itemSearch.sFacID) ? w.nFacilities == nFacID : true)).OrderByDescending(o => o.dAction).ThenBy(o => o.sYear).ThenBy(o => o.nMonth).ThenBy(o => o.sNameFacilities).ThenBy(o => o.sNameIndicator).ToList(); #endregion } #region//SORT int?nSortCol = SystemFunction.GetIntNull(itemSearch.sIndexCol); switch ((itemSearch.sOrderBy + "").ToLower()) { case SystemFunction.ASC: { switch (nSortCol) { case 1: lstPerm = lstPerm.OrderBy(o => int.Parse(o.sYear)).ToList(); break; case 2: lstPerm = lstPerm.OrderBy(o => o.nMonth).ToList(); break; case 3: lstPerm = lstPerm.OrderBy(o => o.sNameFacilities).ToList(); break; case 4: lstPerm = lstPerm.OrderBy(o => o.sNameIndicator).ToList(); break; //case 5: lstPerm = lstPerm.OrderBy(o => o.nStatus).ToList(); break; } } break; case SystemFunction.DESC: { switch (nSortCol) { case 1: lstPerm = lstPerm.OrderByDescending(o => int.Parse(o.sYear)).ToList(); break; case 2: lstPerm = lstPerm.OrderByDescending(o => o.nMonth).ToList(); break; case 3: lstPerm = lstPerm.OrderByDescending(o => o.sNameFacilities).ToList(); break; case 4: lstPerm = lstPerm.OrderByDescending(o => o.sNameIndicator).ToList(); break; //case 5: lstPerm = lstPerm.OrderByDescending(o => o.nStatus).ToList(); break; } } break; } #endregion #region//Final Action >> Skip Take Data For Javasacript sysGlobalClass.Pagination dataPage = new sysGlobalClass.Pagination(); dataPage = SystemFunction.GetPaginationSmall(SystemFunction.GetIntNullToZero(itemSearch.sPageSize), SystemFunction.GetIntNullToZero(itemSearch.sPageIndex), lstPerm.Count); lstPerm = lstPerm.Skip(dataPage.nSkipData).Take(dataPage.nTakeData).ToList(); foreach (var item in lstPerm) { if (nRole == 3 || nRole == 4)//L1,L2 { item.sBtn = "<a class='btn btn-primary' href='epi_mytask_view.aspx?strid=" + HttpContext.Current.Server.UrlEncode(STCrypt.Encrypt(item.nFormID.ToString())) + "&strlevel=" + HttpContext.Current.Server.UrlEncode(STCrypt.Encrypt(nRole.ToString())) + "'>" + "<i class='fa fa-search'></i> View Detail</a>"; } else if (nRole == 2)//L0 { string shref = SystemFunction.ReturnPath(item.nIndicator, item.nOperationtypeID ?? 0, item.nFacilities + "", item.sYear, ""); item.sBtn = "<a class='btn btn-warning btn-sm' title='Action' href='" + shref + "'><i class='fa fa-edit'></i></a>"; } } result.lstData = lstPerm; result.nPageCount = dataPage.nPageCount; result.nPageIndex = dataPage.nPageIndex; result.sPageInfo = dataPage.sPageInfo; result.sContentPageIndex = dataPage.sContentPageIndex; result.nStartItemIndex = dataPage.nStartItemIndex; #endregion } else { result.Status = SystemFunction.process_SessionExpired; } return(result); }
protected void lbtnLogout_Click(object sender, EventArgs e) { CommonFunction comFun = new CommonFunction(); comFun.clearSessionAndCookies(); Response.Redirect("~/Login.aspx"); }
/// <summary> /// Load lại dữ liệu khi có thay đổi từ form chi tiết /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void userControl_OnSavingCompleted(object sender, EventArgs e) { LoadGrid(); CommonFunction.GoToPosition(currentID, ref grid, radPage, nudPageSize); }
/// <summary> /// 真机跑H5用例 /// </summary> public void TestDeviceH5() { CommonFunction comFun=new CommonFunction(); comFun.InitivlEvu(DriverType.androidDevice); }
/// <summary> /// Trước khi xóa /// </summary> private void BeforeDelete() { try { List <NS_DM_DANH_MUC_DTO> listDataRow = getListSeletedDataRow(); if (listDataRow != null) { if (listDataRow.Count == 0) { LMessage.ShowMessage("M.DungChung.ChuaChonBanGhi", LMessage.MessageBoxType.Warning); return; } else { // Lấy danh sách dữ liệu cần xử lý List <int> listId = new List <int>(); foreach (NS_DM_DANH_MUC_DTO nsDmDanhMuc in listDataRow) { int id = int.Parse(nsDmDanhMuc.ID.ToString()); listId.Add(id); } // Cảnh báo người dùng MessageBoxResult ret = LMessage.ShowMessage("M.DungChung.HoiXoa", LMessage.MessageBoxType.Question); if (ret == MessageBoxResult.Yes) { // Yêu cầu lock bản ghi cần xử lý UtilitiesProcess process = new UtilitiesProcess(); List <int> listLockedId = new List <int>(); bool retLockData = process.LockData(DatabaseConstant.Module.NSTL, DatabaseConstant.Function.NS_DM_DANH_MUC_DS, DatabaseConstant.Table.NS_DM_DANH_MUC, DatabaseConstant.Action.XOA, listId); // Nếu lock thành công >> cho phép xử lý if (retLockData) { OnDelete(listId); } else { LMessage.ShowMessage("M.ResponseMessage.Common.LockDataInvalid", LMessage.MessageBoxType.Information); } } } } else { LMessage.ShowMessage("M.DungChung.LoiChonDuLieu", LMessage.MessageBoxType.Warning); return; } } catch (Exception ex) { CommonFunction.ThongBaoLoi(ex); LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); } }
/// <summary> /// 初始化T28181监控平台 /// </summary> /// <param name="monitorConfigElement">监控平台配置节点</param> /// <returns></returns> public SmcErr Load(System.Xml.XmlElement monitorConfigElement) { NLogEx.LoggerEx logEx = new NLogEx.LoggerEx(log); logEx.Trace("Enter: T28181VideoMonitor.Load()."); SmcErr err = new CgwError(); try { //解析xml节点,获取所需参数 string queryDeviceTimeOut = string.Empty; monitorId = CommonFunction.GetSingleNodeValue(monitorConfigElement, CgwConst.ID_TAG); domain = CommonFunction.GetSingleNodeValue(monitorConfigElement, CgwConst.IP_TAG); sipPort = CommonFunction.GetSingleNodeValue(monitorConfigElement, CgwConst.SIP_PORT); deviceID = CommonFunction.GetSingleNodeValue(monitorConfigElement, CgwConst.Device_ID); username = CommonFunction.GetSingleNodeValue(monitorConfigElement, CgwConst.USER_TAG); password = CommonFunction.GetSingleNodeValue(monitorConfigElement, CgwConst.PASSWORD_TAG); localPort = CommonFunction.GetSingleNodeValue(monitorConfigElement, CgwConst.LOCAL_PORT); queryDeviceTimeOut = CommonFunction.GetSingleNodeValue(monitorConfigElement, CgwConst.QueryDeviceTimeOut); //检测配置文件是否有错误 int iSipPort = 0; bool bRet = int.TryParse(sipPort, out iSipPort); if (bRet == false) { err.SetErrorNo(CgwError.MONITOR_CONFIG_FILE_INVALID); logEx.Error("Load T28181 monitor failed.Execption sipPort:{0}.", sipPort); return(err); } int iLocalPort = 0; bRet = int.TryParse(localPort, out iLocalPort); if (bRet == false) { err.SetErrorNo(CgwError.MONITOR_CONFIG_FILE_INVALID); logEx.Error("Load T28181 monitor failed.Execption localPort:{0}.", localPort); return(err); } bRet = int.TryParse(queryDeviceTimeOut, out iQueryDeviceTimeOut); //转为毫秒 iQueryDeviceTimeOut *= 1000; if (bRet == false) { err.SetErrorNo(CgwError.MONITOR_CONFIG_FILE_INVALID); logEx.Error("Load T28181 monitor failed.Execption QueryDeviceTimeOut:{0}.", iQueryDeviceTimeOut); return(err); } //开始连接、注册Sip服务器 StartConnectRegisterSip(domain, iSipPort, iLocalPort, username, password); //开始查询设备列表 Thread th = new Thread(new ThreadStart(() => { GetAllCamerasTimer(null, null); })); th.Start(); //启动定时器 updateCameraTimer.Start(); } catch (Exception e) { err.SetErrorNo(CgwError.MONITOR_CONFIG_FILE_INVALID); logEx.Error("Load T28181 monitor failed.Execption message:{0}.", e.Message); return(err); } logEx.Info("Load T28181 monitor success.Monitor id:{0}.", this.monitorId); return(err); }
protected void Page_Load(object sender, EventArgs e) { Auth.CheckPermission("BASE", "CLOSETR"); // recupera oggetto con variabili di sessione CurrentSession = (TRSession)Session["CurrentSession"]; // ********* Check ore ************* CommonFunction.CalcolaPercOutput ret = CommonFunction.CalcolaPercOre(Convert.ToInt16(CurrentSession.Persons_id), Convert.ToInt16(Session["Month"]), Convert.ToInt16(Session["Year"])); CheckOre.Text = GetLocalResourceObject("orecaricate").ToString() + ret.dOreCaricate.ToString() + GetLocalResourceObject("su").ToString() + ret.dOreLavorative.ToString(); CheckOreImg.ImageUrl = Convert.ToInt16(ret.sPerc) >= 100 ? "/timereport/images/icons/50x50/icon-ok.png" : "/timereport/images/icons/50x50/icon-alert.png"; CheckOrePerc.Text = " " + ret.sPerc + "%"; if (ret.dOreLavorative > 0) { divbar.Style.Add("width", (Math.Round(ret.dOreCaricate / ret.dOreLavorative * 100).ToString() + "%")); } // ********* Check Ticket ************* CheckChiusura.CheckAnomalia oAnomalia = new CheckChiusura.CheckAnomalia(); List <CheckChiusura.CheckAnomalia> ListaAnomalie = new List <CheckChiusura.CheckAnomalia> { }; // ** Inizio Check: se esterno il check non è rilevante ** if (!Auth.ReturnPermission("DATI", "BUONI")) { CheckTicketAssenti.Text = GetLocalResourceObject("ticket_msg1").ToString(); // "Ticket: Non rilevante"; CheckTicketAssentiImg.ImageUrl = "/timereport/images/icons/50x50/icon-ok.png"; CheckTicketHomeOffice.Text = GetLocalResourceObject("ticket_msg3").ToString(); // "Ticket: Non rilevante"; CheckTicketHomeOfficeImg.ImageUrl = "/timereport/images/icons/50x50/icon-ok.png"; } else // se interno chiama la funzione che esegue il check { switch (CheckChiusura.CheckTicketAssenti(Session["Month"].ToString(), Session["Year"].ToString(), CurrentSession.Persons_id.ToString(), ref ListaAnomalie)) { case 0: CheckTicketAssenti.Text = GetLocalResourceObject("ticket_msg2").ToString(); // "Ticket: Controllo ok"; CheckTicketAssentiImg.ImageUrl = "/timereport/images/icons/50x50/icon-ok.png"; break; case 1: CheckTicketAssenti.Text = "<a style='text-decoration: underline' href='/timereport/report/chiusura/ChiusuraTRDettagli.aspx?type=01'>" + ListaAnomalie.Count + " ticket o rimborsi</a>" + " travel assenti"; CheckTicketAssentiImg.ImageUrl = "/timereport/images/icons/50x50/icon-alert.png"; break; case 2: // non usato break; } switch (CheckChiusura.CheckTicketHomeOffice(Session["Month"].ToString(), Session["Year"].ToString(), CurrentSession.Persons_id.ToString(), ref ListaAnomalie)) { case 0: CheckTicketHomeOffice.Text = GetLocalResourceObject("ticket_msg4").ToString(); // "Ticket: Controllo ok"; CheckTicketHomeOfficeImg.ImageUrl = "/timereport/images/icons/50x50/icon-ok.png"; break; case 1: CheckTicketHomeOffice.Text = "<a style='text-decoration: underline' href='/timereport/report/chiusura/ChiusuraTRDettagli.aspx?type=04'>" + ListaAnomalie.Count + " ticket</a>" + " caricati su giornate Home Office"; CheckTicketHomeOfficeImg.ImageUrl = "/timereport/images/icons/50x50/icon-alert.png"; break; case 2: // non usato break; } } // ** Fine Check ** // ********* Check Spese ************* int bCheckResult = CheckChiusura.CheckSpese(Session["Month"].ToString(), Session["Year"].ToString(), CurrentSession.Persons_id.ToString(), ref ListaAnomalie); CheckSpese.Text = bCheckResult == 0 ? "Carichi spese controllati" : "<a style='text-decoration: underline' href='/timereport/report/chiusura/ChiusuraTRDettagli.aspx?type=02'>" + ListaAnomalie.Count + " spese caricate</a> su commessa non presente nella giornata"; CheckSpeseImg.ImageUrl = bCheckResult == 0 ? "/timereport/images/icons/50x50/icon-ok.png" : "/timereport/images/icons/50x50/icon-alert.png"; // imposta indirizzo stampa ricevute btStampaRicevute.OnClientClick = "window.open('/timereport/report/ricevute/ricevute_list.aspx?mese=" + Session["Month"] + "&anno=" + Session["Year"] + "')"; // ********* Check Assenze ************* int iCheckAssenze = CheckChiusura.CheckAssenze(Session["Month"].ToString(), Session["Year"].ToString(), CurrentSession.Persons_id.ToString(), ref ListaAnomalie); if (iCheckAssenze > 0) { CheckAssenze.Text = "<a style='text-decoration: underline' href='/timereport/report/chiusura/ChiusuraTRDettagli.aspx?type=03'>" + ListaAnomalie.Count + " richieste</a> in attesa di conferma"; CheckAssenzeImg.ImageUrl = "/timereport/images/icons/50x50/icon-alert.png"; } } // Page_Load()