/// <summary> /// Update Database Make data as Obsoluted /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void IsObsolete_CheckedChanged(Object sender, EventArgs e) { string message = string.Empty; try { CheckBox chk = (CheckBox)sender; GridViewRow gr = (GridViewRow)chk.Parent.Parent; string CardTypeID = ((Literal)gr.FindControl("litCardTypeID")).Text; CardTypeBLL CardTypeBLLobj = new CardTypeBLL(); message = CardTypeBLLobj.ObsoleteCardType(Convert.ToInt32(CardTypeID), Convert.ToString(chk.Checked)); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; } BindGrid(false, true); if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Set Grid Data source /// </summary> /// <param name="addRow"></param> /// <param name="deleteRow"></param> private void BindGrid(bool addRow, bool deleteRow) { CardTypeBLL CardTypeBLLobj = new CardTypeBLL(); grdCardType.DataSource = CardTypeBLLobj.GETALLCardType(); grdCardType.DataBind(); }
/// <summary> /// Set edit mode for edit comand /// Delete data from the database for delete comand /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void grdCardType_RowCommand(object sender, GridViewCommandEventArgs e) { string message = string.Empty; if (e.CommandName == "EditRow") { ViewState["CardTypeID"] = e.CommandArgument; int concrnID = Convert.ToInt32(ViewState["CardTypeID"]); GetCardTypeDetails(concrnID); SetUpdateMode(true); ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true); } else if (e.CommandName == "DeleteRow") { CardTypeBLL CardTypeBLLobj = new CardTypeBLL(); message = CardTypeBLLobj.DeleteCardType(Convert.ToInt32(e.CommandArgument)); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data Deleted successfully"; } clear(); SetUpdateMode(false); BindGrid(false, true); } if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } }
/// <summary> /// 窗体加载 /// </summary> private void InitForm() { dgvMain.Top = 70; dgvMain.Left = 0; dgvMain.Width = this.Width; dgvMain.Height = this.Height - dgvMain.Top - 63; dgvMain.ReadOnly = true; dgvMain.MultiSelect = false; dgvMain.SelectionMode = DataGridViewSelectionMode.FullRowSelect; this.Text = Bouwa.ITSP2V31.Model.CardInfo.InfoName + ""; btnSearch.Width = btnReset.Width = 50; btnSearch.Height = btnReset.Height = 20; //this.ddlStatus.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; Helper.FormControlHelper.BindEnumToComboBox(ddlCostType, typeof(CardTypeInfo.CardTypeInfoCostTypeQianJiang), false, CardTypeInfo.CardTypeInfoCostTypeQianJiang.金额卡.ToString("D")); Helper.FormControlHelper.BindEnumToComboBox(ddlPurpose, typeof(CardTypeInfo.CardTypeInfoPurpose), true, ""); Helper.FormControlHelper.BindEnumToComboBox(ddlStatus, typeof(CardTypeInfo.CardTypeInfoDefaultCardStatus), true, ""); Hashtable table = new Hashtable(); string RegisterType = string.Empty; //注册类型 table.Add("tcit_system", (int)CurrentUser.Current.PARKING_SYSTEM); table.Add("tcit_type", (int)CurrentUser.Current.PARK_BACKSTAGE); table.Add("tcit_code", CurrentUser.Current.RegisterType); CardTypeBLL _objCardTypeBLL = new CardTypeBLL(); RegisterType = _objCardTypeBLL.GetRegisterType(table, null); if (RegisterType == "实名") { Helper.FormControlHelper.BindEnumToComboBox(ddlRegistType, typeof(CardTypeInfo.CardTypeInfoSubmitType_Name), false, CardTypeInfo.CardTypeInfoSubmitType_Name.实名.ToString("D")); } else if (RegisterType == "不记名") { Helper.FormControlHelper.BindEnumToComboBox(ddlRegistType, typeof(CardTypeInfo.CardTypeInfoSubmitType_UnName), false, CardTypeInfo.CardTypeInfoSubmitType_UnName.记名.ToString("D")); } else { Helper.FormControlHelper.BindEnumToComboBox(ddlRegistType, typeof(CardTypeInfo.CardTypeInfoSubmitType), true, ""); } this.ddlOrderName.Items.Insert(0, "批次"); this.ddlOrderName.Items.Add("停车卡类型"); this.ddlOrderName.Text = this.ddlOrderName.Items[0].ToString(); this.ddlOrderBy.Items.Insert(0, "升序"); this.ddlOrderBy.Items.Add("降序"); this.ddlOrderBy.Text = this.ddlOrderBy.Items[0].ToString(); }
/// <summary> /// get the Grid value into textBox /// </summary> private void GetCardTypeDetails(int CardTypeID) { CardTypeBLL CardTypeBLLobj = new CardTypeBLL(); //int CardTypeID = 0; //if (ViewState["CardTypeID"] != null) // CardTypeID = Convert.ToInt32(ViewState["CardTypeID"]); CardTypeBO CardTypeObj = new CardTypeBO(); CardTypeObj = CardTypeBLLobj.GetCardTypeById(CardTypeID); CardTypeTextBox.Text = CardTypeObj.CardTypeName; CardTypeIDTextBox.Text = CardTypeObj.CardTypeID.ToString(); //int CardTypeID_test = Convert.ToInt32(CardTypeObj.CardTypeID); }
/// <summary> /// 窗体加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void View_Load(object sender, EventArgs e) { _eumActionType = (ActionType)int.Parse(this.Parameter["ActionType"].ToString()); if (this.Parameter["Id"] != null) { _objId = new Guid(this.Parameter["Id"].ToString()); } InitForm(); SetControlVisible(); SetFormFromInfo(_objId); //充值,卡重置,退卡,申请换卡权限 this.btnChargeValue.Visible = _objLoginBLL.IsRightByUserIdRightInfoListRightCode("Winform.Card.Info.IniMoney", null, ref _objSystemMessageInfo); this.btnReset.Visible = _objLoginBLL.IsRightByUserIdRightInfoListRightCode("Winform.Card.Type.ResetCard", null, ref _objSystemMessageInfo); this.btnBack.Visible = _objLoginBLL.IsRightByUserIdRightInfoListRightCode("Winform.Card.Info.BackCard", null, ref _objSystemMessageInfo); this.btnChangeCard.Visible = _objLoginBLL.IsRightByUserIdRightInfoListRightCode("Winform.Card.Info.ChangeCard", null, ref _objSystemMessageInfo); //根据卡状态判断是否显示其他按钮,如果为已挂失状态,则屏蔽其他的按钮 if (_objCardInfo != null && _objCardInfo.status == Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoDefaultCardStatus.已挂失) { this.btnChargeValue.Visible = false; this.btnReset.Visible = false; this.btnBack.Visible = false; this.btnChangeCard.Visible = false; this.btnChangeCard.Text = "换卡"; this.btnChangeCard.Tag = "1"; //获得配置文件中的初始化标志位,Test Hashtable table = new Hashtable(); table.Add("tcit_system", (int)CurrentUser.Current.PARKING_SYSTEM); table.Add("tcit_type", (int)CurrentUser.Current.CS_CLIENT); table.Add("tcit_code", SystemConstant.ChangeCardIntervalTime); CardTypeBLL _objCardTypeBLL = new CardTypeBLL(); //根据配置表根据间隔时间来确认是否显示换卡按钮,必须要大于今天 string initFlag = _objCardTypeBLL.GetRegisterType(table, null); if (!string.IsNullOrEmpty(initFlag) && (DateTime.Compare(DateTime.Now, _objCardInfo.modify_time.AddMinutes(Convert.ToDouble(initFlag))) >= 0)) { this.btnChangeCard.Visible = true; } } }
/// <summary> /// 初始化写卡数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tbnWriteCard_Click(object sender, EventArgs e) { string d = Guid.NewGuid().ToString("N"); string password = CurrentUser.Current.PassWordKey; try { bool flag = false; string[] mary1 = StringUtil.readBlock(RFIDClass.ReadCardAndReturnStatus(password, Convert.ToInt32(1))); if (mary1[4] == "11" || mary1[4] == "12") { flag = true; password = SystemConstant.StringEmpty; mary1 = StringUtil.readBlock(RFIDClass.ReadCardAndReturnStatus(password, Convert.ToInt32(1))); } if (mary1[4] != "0") { throw new Exception(RFIDClass.ConvertMeassByStatus(Convert.ToInt32(mary1[4]))); } string cardStatus = string.IsNullOrEmpty(mary1[2])?"":mary1[2]; //判断如果长度是16 if (cardStatus.Length >= 16) { cardStatus = HelperClass.getCardStatus(cardStatus.Substring(13, 1)); } else { cardStatus = Bouwa.ITSP2V31.Model.CardTypeInfo.CardTypeInfoDefaultCardStatus.空白卡.ToString("D"); } //如果是从重新初始化的按钮进入,则跳过下面判断 if (!(Bouwa.ITSP2V31.Model.CardTypeInfo.CardTypeInfoDefaultCardStatus.空白卡.ToString("D").Equals(cardStatus) || (cardStatus.Equals(CardTypeInfo.CardTypeInfoDefaultCardStatus.已充值.ToString("D")) && string.IsNullOrEmpty(HelperClass.DecryptByString(mary1[3] == null ? "" : mary1[3].ToString()))) || flag)) { this.lblNum.Text = string.Empty; MessageBoxForm.Show("此卡非空卡,请更换卡!", MessageBoxButtons.OK); return; } if (!mary1[0].Equals(this.lblNum.Text)) { //MessageBoxForm.Show(_objSystemMessage.GetInfoByCode("ReadNoSameCard"), MessageBoxButtons.OK); MessageBoxForm.Show("读取停车卡和待写入卡不是同一张卡,不能被写入!", MessageBoxButtons.OK); return; } if (string.IsNullOrEmpty(this.lblNum.Text)) { this.lblNum.Text = string.Empty; MessageBoxForm.Show("未读取到卡内编号,请重试!", MessageBoxButtons.OK); return; } if (string.IsNullOrEmpty(this.tbxCardNum.Text)) { MessageBoxForm.Show("卡面编号不能为空,请重新输入!", MessageBoxButtons.OK); return; } //判断卡面编号输入是否合法 Regex rx = new Regex("^[\u4E00-\u9FA5]+$"); if (rx.IsMatch(this.tbxCardNum.Text.Trim())) { MessageBoxForm.Show("卡面编号必须是数字或者字母,请重新输入!", MessageBoxButtons.OK); return; } //判断输入的值是否超过预定的最大值 string maxValue = "0"; Hashtable table = new Hashtable(); CardTypeBLL _objCardTypeBLL = new CardTypeBLL(); table.Add("tcit_system", (int)CurrentUser.Current.PARKING_SYSTEM); table.Add("tcit_type", (int)CurrentUser.Current.PARK_BACKSTAGE); //判断上限分钟是否大于预设值 if (this.lblCostType.Text.Equals(Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoCostType.限时卡.ToString("D"))) { table.Add("tcit_code", CurrentUser.Current.MaxTime); maxValue = _objCardTypeBLL.GetRegisterType(table, null); int max = 0; Regex regex = new Regex("[^0-9]"); if (string.IsNullOrEmpty(this.tbxOverPlus.Text)) { MessageBoxForm.Show("剩余时间不能为空!", MessageBoxButtons.OK); return; } if (regex.IsMatch(maxValue)) { MessageBoxForm.Show("限时预设值格式不正确,无法继续充值,请联系管理员!", MessageBoxButtons.OK); return; } if (regex.IsMatch(this.tbxOverPlus.Text)) { MessageBoxForm.Show("剩余时间必须为数字,请重新输入!", MessageBoxButtons.OK); return; } max = Convert.ToInt32(this.tbxOverPlus.Text); if (Convert.ToInt32(this.tbxOverPlus.Text) > Convert.ToInt32(this.tbxMax.Text)) { MessageBoxForm.Show("剩余时间不能大于上限时间!", MessageBoxButtons.OK); return; } if (Convert.ToInt32(this.tbxOverPlus.Text) > max) { MessageBoxForm.Show("剩余时间不能大于预设最大" + maxValue + "分!", MessageBoxButtons.OK); return; } } //判断剩余次数是否大于预设值 else if (this.lblCostType.Text.Equals(Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoCostType.限次卡.ToString("D"))) { table.Add("tcit_code", CurrentUser.Current.MaxDegree); maxValue = _objCardTypeBLL.GetRegisterType(table, null); int max = 0; Regex regex = new Regex("[^0-9]"); if (string.IsNullOrEmpty(this.tbxOverPlus.Text)) { MessageBoxForm.Show("剩余次数不能为空!", MessageBoxButtons.OK); return; } if (regex.IsMatch(maxValue)) { MessageBoxForm.Show("次数预设值格式不正确,无法继续初始化,请联系管理员!", MessageBoxButtons.OK); return; } if (regex.IsMatch(this.tbxOverPlus.Text)) { MessageBoxForm.Show("剩余次数必须为数字,请重新输入!", MessageBoxButtons.OK); return; } max = Int32.Parse(this.tbxOverPlus.Text); if (Convert.ToInt32(this.tbxOverPlus.Text) > Convert.ToInt32(this.tbxMax.Text)) { MessageBoxForm.Show("剩余次数不能大于上限次数!", MessageBoxButtons.OK); return; } if (Convert.ToInt32(this.tbxOverPlus.Text) > Convert.ToInt32(maxValue)) { MessageBoxForm.Show("剩余次数不能大于预设最大" + maxValue + "次!", MessageBoxButtons.OK); return; } } //判断剩余金额是否大于预设值 else if (this.lblCostType.Text.Equals(Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoCostType.金额卡.ToString("D"))) { table.Add("tcit_code", CurrentUser.Current.MaxMoney); maxValue = _objCardTypeBLL.GetRegisterType(table, null); decimal max = new Decimal(0.00); Regex RegDecimalSign = new Regex("^[+-]?[0-9]+[.]?[0-9]+$"); if (string.IsNullOrEmpty(this.tbxOverPlus.Text)) { MessageBoxForm.Show("剩余次数不能为空!", MessageBoxButtons.OK); return; } if (!RegDecimalSign.IsMatch(maxValue)) { MessageBoxForm.Show("次数预设值格式不正确,无法继续初始化,请联系管理员!", MessageBoxButtons.OK); return; } if (!RegDecimalSign.IsMatch(this.tbxOverPlus.Text)) { MessageBoxForm.Show("剩余次数必须为数字,请重新输入!", MessageBoxButtons.OK); return; } max = Convert.ToDecimal(this.tbxOverPlus.Text); if (Convert.ToDecimal(this.tbxOverPlus.Text) > Convert.ToDecimal(this.tbxMax.Text)) { MessageBoxForm.Show("剩余金额不能大于上限金额!", MessageBoxButtons.OK); return; } if (Convert.ToDecimal(this.tbxOverPlus.Text) > max) { MessageBoxForm.Show("剩余金额不能大于上限金额" + maxValue + "元!", MessageBoxButtons.OK); return; } } StringBuilder sb = new StringBuilder(); //初始化写入密码 RFIDClass.UpdateCardPassWordAndReturnStatus(this.lblNum.Text, 1, SystemConstant.StringEmpty, CurrentUser.Current.PassWordKey); //写入扩展的SAASID if (!"0".Equals(SystemConstant.saas_type.SAAS_TYPE.ToString("D"))) { sb.Append(StringUtil.formatDataString(Convert.ToInt32(lblExtSaasId.Text), 3)); } //写入系统编号 sb.Append(SystemConstant.system_type.CS_SYSTEM.ToString("D")); //写入剩余金额及剩余次数及剩余时间,限期卡为5个0,限时卡前面是小时数,最后一位是分钟数数 if (this.lblCostType.Text.Equals(Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoCostType.限期卡.ToString("D"))) { sb.Append(StringUtil.formatDataString(0, 5)); } else if (this.lblCostType.Text.Equals(Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoCostType.限时卡.ToString("D"))) { string hours = Convert.ToString(Convert.ToInt32(this.tbxOverPlus.Text) / 60); //根据输入分钟数,输入数字除60取余计算出小时数 string minutes = Convert.ToString(Convert.ToInt32(this.tbxOverPlus.Text) % 60 / 10); //根据输入数字除60取模,然后再除以10,得到分钟数,1代表10分钟,2代表20分钟,依次类推 sb.Append(StringUtil.formatDataString(Convert.ToInt32(hours + minutes), 5)); } else if (this.lblCostType.Text.Equals(Bouwa.ITSP2V31.Model.CardInfo.CardTypeInfoCostType.金额卡.ToString("D"))) { //格式化金额的存储,前4位保存整数,后1位保存小数点后面第一位 string money = Convert.ToDecimal(this.tbxOverPlus.Text).ToString("0.0"); sb.Append(StringUtil.formatDataString(Convert.ToInt32(money.Replace(".", "")), 5)); } else { sb.Append(StringUtil.formatDataString(Convert.ToInt32(this.tbxOverPlus.Text), 5)); } //写入卡面编号 sb.Append(StringUtil.formatDataString(this.tbxCardNum.Text, 7)); //写入第一扇区的第零块 writeBlock(1, 0, sb.ToString()); sb = new StringBuilder(); //写入生效日期 sb.Append(DateTime.Parse(this.lblEffectDate.Text).ToString("yyMMdd")); //写入最晚日期 sb.Append(DateTime.Parse(this.lblOutDate.Text).ToString("yyMMdd")); //写入扣费类型 sb.Append(this.lblCostType.Text.ToString()); //写入停车卡状态 sb.Append(Bouwa.ITSP2V31.Model.CardTypeInfo.CardTypeInfoDefaultCardStatus.已充值.ToString("D")); //写入卡类型 sb.Append(StringUtil.formatDataString(this.lblExtCardTypeId.Text.ToString(), 2)); //写入第一扇区的第一块 writeBlock(1, 1, sb.ToString()); //把最后操作时间写入第一扇区的第二块 sb = new StringBuilder(); sb.Append(DateTime.Now.ToString("yyyyMMddHHmmss")); writeBlock(1, 2, sb.ToString()); RFIDClass.IssueSound(50); //发出声音代表完成 //将该卡信息写入后台数据库 Hashtable cardInfo = new Hashtable(); //插入初始化记录 Hashtable htCardInfo = new Hashtable(); //主键 cardInfo.Add("id", Guid.NewGuid()); htCardInfo.Add("id", Guid.NewGuid().ToString()); //saasId if (!string.IsNullOrEmpty(this.lblSaasId.Text)) { cardInfo.Add("saas_id", new Guid(this.lblSaasId.Text)); htCardInfo.Add("saas_id", this.lblSaasId.Text); } //卡内编号 if (!string.IsNullOrEmpty(this.lblNum.Text)) { cardInfo.Add("card_id", this.lblNum.Text); htCardInfo.Add("card_id", Guid.Empty.ToString()); } else { MessageBoxForm.Show("未读取到卡内编号,请重试!", MessageBoxButtons.OK); return; } //卡面编号 if (!string.IsNullOrEmpty(this.tbxCardNum.Text.Trim())) { cardInfo.Add("no", StringUtil.formatDataString(this.tbxCardNum.Text, 7)); htCardInfo.Add("no", StringUtil.formatDataString(this.tbxCardNum.Text, 7)); } else { MessageBoxForm.Show("卡面编号不能为空,请重新输入!", MessageBoxButtons.OK); return; } //批次 if (!string.IsNullOrEmpty(this.tbxLotNum.Text)) { cardInfo.Add("batch", this.tbxLotNum.Text); } //停车卡类型 if (!string.IsNullOrEmpty(this.lblCardTypeId.Text)) { cardInfo.Add("card_type", _objId.ToString()); } cardInfo.Add("status", Bouwa.ITSP2V31.Model.CardTypeInfo.CardTypeInfoDefaultCardStatus.已充值.ToString("D")); //生效日期 if (!string.IsNullOrEmpty(this.lblEffectDate.Text)) { cardInfo.Add("efffect_date", Convert.ToDateTime(this.lblEffectDate.Text)); } //最晚到期 if (!string.IsNullOrEmpty(this.lblOutDate.Text)) { cardInfo.Add("end_date", Convert.ToDateTime(this.lblOutDate.Text)); } //停车卡用途 if (!string.IsNullOrEmpty(this.lblPurpose.Text)) { cardInfo.Add("purpose", Convert.ToInt32(this.lblPurpose.Text)); //cardInfo.purpose = 0; } //注册类型 if (!string.IsNullOrEmpty(this.lblSubmitType.Text)) { cardInfo.Add("submit_type", Convert.ToInt32(this.lblSubmitType.Text)); } //扣费类型 if (!string.IsNullOrEmpty(this.lblCostType.Text)) { cardInfo.Add("cost_type", Convert.ToInt32(this.lblCostType.Text)); htCardInfo.Add("cost_type", Convert.ToInt32(this.lblCostType.Text)); } //初始化操作日志,仅对非空白卡进行写数据 string message = SystemConstant.StringEmpty; //剩余操作次数 if (this.lblCostType.Text.Equals(CardTypeInfo.CardTypeInfoCostType.限次卡.ToString("D"))) { cardInfo.Add("times", Convert.ToInt32(this.tbxOverPlus.Text)); //备注信息 cardInfo.Add("memo", this.tbxCardNum.Text + "初始化成功!"); htCardInfo.Add("volume", Convert.ToInt32(this.tbxOverPlus.Text)); //htCardInfo.Add("operation_memo", String.Format(_objSystemMessage.GetInfoByCode("InitMemo").Content, this.tbxCardNum.Text, String.Format(_objSystemMessage.GetInfoByCode("InitTime").Content, this.tbxOverPlus.Text))); message = "InitTime"; } else { cardInfo.Add("times", 0); } //剩余操作金额 if (this.lblCostType.Text.Equals(CardTypeInfo.CardTypeInfoCostType.金额卡.ToString("D"))) { cardInfo.Add("money", Convert.ToDecimal(this.tbxOverPlus.Text)); //备注信息 cardInfo.Add("memo", this.tbxCardNum.Text + "初始化成功!"); htCardInfo.Add("volume", Convert.ToDecimal(this.tbxOverPlus.Text)); // htCardInfo.Add("operation_memo", String.Format(_objSystemMessage.GetInfoByCode("InitMemo").Content, this.tbxCardNum.Text, String.Format(_objSystemMessage.GetInfoByCode("InitMoney").Content, this.tbxOverPlus.Text))); message = "InitMoney"; } else { cardInfo.Add("money", 0); } //剩余计费时间 if (this.lblCostType.Text.Equals(CardTypeInfo.CardTypeInfoCostType.限时卡.ToString("D"))) { cardInfo.Add("charges_date", Convert.ToInt32(this.tbxOverPlus.Text)); //备注信息 cardInfo.Add("memo", this.tbxCardNum.Text + "初始化成功!"); htCardInfo.Add("volume", Convert.ToInt32(this.tbxOverPlus.Text)); //htCardInfo.Add("operation_memo", String.Format(_objSystemMessage.GetInfoByCode("InitMemo").Content, this.tbxCardNum.Text, String.Format(_objSystemMessage.GetInfoByCode("InitDegree").Content, this.tbxOverPlus.Text))); message = "InitDegree"; } else { cardInfo.Add("charges_date", 0); } //剩余计费时间 if (this.lblCostType.Text.Equals(CardTypeInfo.CardTypeInfoCostType.限期卡.ToString("D"))) { //备注信息 cardInfo.Add("memo", this.tbxCardNum.Text + "初始化成功!"); htCardInfo.Add("volume", Convert.ToDateTime(this.lblOutDate.Text).ToString("yyyyMMdd")); //htCardInfo.Add("operation_memo", "初始化成功!"); message = "InitDate"; } htCardInfo.Add("operation_memo_init", _objSystemMessage.GetInfoByCode("InitMemo").Content); htCardInfo.Add("operation_type_init", 1); if (this.ddlStatus.Text == CardTypeInfo.CardTypeInfoDefaultCardStatus.已充值.ToString()) { htCardInfo.Add("operation_type_payment", 5); htCardInfo.Add("operation_memo_payment", string.Format(_objSystemMessage.GetInfoByCode(message).Content, this.tbxOverPlus.Text)); } //初始化人员ID cardInfo.Add("create_user", CurrentUser.Current.UserId); htCardInfo.Add("operation_user", CurrentUser.Current.UserId); //初始化时间 cardInfo.Add("create_time", DateTime.Now); htCardInfo.Add("operation_time", DateTime.Now.ToString()); htCardInfo.Add("modity_user", CurrentUser.Current.UserId); htCardInfo.Add("modity_time", DateTime.Now.ToString()); // htCardInfo.Add("operation_type","1"); htCardInfo.Add("address_type", "1"); htCardInfo.Add("network_id", CurrentUser.Current.NetWorkID); string mes = _objCardInfoBLL.ChangeCardInitAndBack(cardInfo, htCardInfo, null, ref _objSystemMessageInfo); if ("换卡操作成功!".Equals(mes)) { MessageBoxForm.Show("停车卡[" + this.tbxCardNum.Text + "]换卡成功!", MessageBoxButtons.OK); this.Close(); } else if ("换卡操作失败!".Equals(mes)) { //写入停车卡状态 RFIDClass.UpdateCardPassWordAndReturnStatus(this.lblNum.Text, 1, password, SystemConstant.StringEmpty); writeBlock(1, 0, ""); writeBlock(1, 1, ""); writeBlock(1, 2, ""); MessageBoxForm.Show("停车卡[" + this.tbxCardNum.Text + "]换卡失败!", MessageBoxButtons.OK); } } catch (Exception ex) { //写入停车卡状态 RFIDClass.UpdateCardPassWordAndReturnStatus(this.lblNum.Text, 1, password, SystemConstant.StringEmpty); writeBlock(1, 0, ""); writeBlock(1, 1, ""); writeBlock(1, 2, ""); MessageBoxForm.Show(ex.Message, MessageBoxButtons.OK); } }
/// <summary> /// save data to database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SaveButton_Click(object sender, EventArgs e) { // int count = 0; string AlertMessage = string.Empty; string message = string.Empty; if (CardTypeIDTextBox.Text.ToString().Trim() == string.Empty) { CardTypeBLL CardTypeBLLOBJ = new CardTypeBLL(); try { string uID = Session["USER_ID"].ToString(); CardTypeBO objCardType = new CardTypeBO(); objCardType.CardTypeName = CardTypeTextBox.Text.ToString().Trim();; objCardType.UserID = Convert.ToInt32(uID); CardTypeBLL CardTypeBLLobj = new CardTypeBLL(); message = CardTypeBLLobj.Insert(objCardType); AlertMessage = "alert('" + message + "');"; if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data saved successfully"; clear(); // ClearDetails(); BindGrid(true, true); } } catch (Exception ex) { throw ex; } finally { CardTypeBLLOBJ = null; } } //edit the data in the textbox exiting in the Grid else if (CardTypeIDTextBox.Text.ToString().Trim() != string.Empty) { CardTypeBLL CardTypeBLLOBJ = new CardTypeBLL(); try { string uID = Session["USER_ID"].ToString(); CardTypeBO objCardType = new CardTypeBO(); objCardType.CardTypeName = CardTypeTextBox.Text.ToString().Trim(); objCardType.CardTypeID = Convert.ToInt32(CardTypeIDTextBox.Text.ToString().Trim()); objCardType.UserID = Convert.ToInt32(uID); CardTypeBLL CardTypeBLLobj = new CardTypeBLL(); message = CardTypeBLLobj.EDITCardType(objCardType); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; // ClearDetails(); clear(); SetUpdateMode(false); BindGrid(true, true); } } catch (Exception ex) { throw ex; } finally { CardTypeBLLOBJ = null; } } AlertMessage = "alert('" + message + "');"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { UsersBLL oUsersBLL = new UsersBLL(); MachineBLL oMachineBLL = new MachineBLL(); userId = MerchantFrontCookieBLL.GetMerchantFrontUserId(); if (userId > 0) { Machine oMachine = new Machine(); oMachine = oMachineBLL.GetModelByUserId(userId); if (oMachine != null) { MachineID = oMachine.MachineID; } } TransNo = BWJSCommonHelper.SafeString(Request["transNo"], ""); TransNo = string.IsNullOrEmpty(TransNo) ? "" : TransNo.Trim(); CaseCode = BWJSCommonHelper.SafeString(Request["CaseCode"], ""); CaseCode = string.IsNullOrEmpty(CaseCode) ? "" : CaseCode.Trim(); protectitemid = BWJSCommonHelper.SafeString(Request["protectitemid"], ""); protectitemid = string.IsNullOrEmpty(protectitemid) ? "" : protectitemid.Trim(); priceArgsId = BWJSCommonHelper.SafeString(Request["priceArgsId"], ""); priceArgsId = string.IsNullOrEmpty(priceArgsId) ? "" : priceArgsId.Trim(); price = BWJSCommonHelper.SafeString(Request["price"], ""); price = string.IsNullOrEmpty(price) ? "" : price.Trim(); SinglePrice = BWJSCommonHelper.SafeString(Request["SinglePrice"], ""); SinglePrice = string.IsNullOrEmpty(SinglePrice) ? "" : SinglePrice.Trim(); buyCount = BWJSCommonHelper.SafeString(Request["buyCount"], ""); buyCount = string.IsNullOrEmpty(buyCount) ? "" : buyCount.Trim(); healthId = BWJSCommonHelper.SafeString(Request["healthId"], ""); healthId = string.IsNullOrEmpty(healthId) ? "" : healthId.Trim(); productId = DNTRequest.GetInt("productId", 0); insurantDateLimitVal = BWJSCommonHelper.SafeString(Request["hdinsurantDateLimitVal"], ""); //承保值 insurantDateLimitUnit = BWJSCommonHelper.SafeString(Request["hdinsurantDateLimitUnit"], ""); //承保单位 CardTypeBLL oCardTypeBLL = new CardTypeBLL(); oCardTypeList = oCardTypeBLL.GetCardTypeList(CaseCode); RelationBLL oRelationBLL = new RelationBLL(); listRelationViewMode = oRelationBLL.GetRelationViewModelList(CaseCode); switch (CaseCode) { case "0000052178002133": isShowProvince = true; isoneSelf = true;//被保人必须是投保人本人 break; case "0001075211202628": isShowcaichansuozaidi = true; isShowrelatedPersonHouse = true; isoneSelf = true; break; case "0000076164701939": isluyouxianCXMDD = true; oTravelDestinationList = oTravelDestinationBLL.GetTravelDestinationList(CaseCode); ProductDestinationReq oProductDestinationReqModel = new ProductDestinationReq(); oProductDestinationReqModel.caseCode = CaseCode; oProductDestinationReqModel.transNo = TransNo; ProductCXDestinationResp oProductCXDestinationResp = oBaoxianDataBLL.ProductDestinations(oProductDestinationReqModel); CXMDDStr = GetCXMDDStr(oProductCXDestinationResp); // isShowrelatedPersonHouse = true; break; case "0000052067400588": isShowcaichansuozaidi = true; isoneSelf = true; break; case "0001077178502139": typeMen = true; break; case "0001077178602140": typeWomen = true; break; case "0001076209802609": //一起慧99-百万医疗保险 无门诊计划 isHaveJob = true; break; case "0001076211102627": //一起慧99-百万医疗保险 有门诊计划 isHaveJob = true; break; case "0001075190802342": //少儿住院宝 isOnlyOthers = true; StartDateParame = 3; // 这个产品要求(起保日期只能为投保日起第三天) break; } List <Products> oProductsList = bll.ProductsByCaseCode(CaseCode); if (oProductsList != null) { ProModel = oProductsList.FirstOrDefault(); } } }