Esempio n. 1
0
 /// <summary>
 /// Class Constructor
 /// </summary>
 public SaveGridForm(EnmSaveBehavior Behavior, IDValuePair <Int32, String> Grid)
 {
     InitializeComponent();
     CurBehavior = Behavior;
     CurGrid     = new IDValuePair <Int32, String>(Grid.ID, Grid.Value);
     Text        = Behavior == EnmSaveBehavior.Add ? "新建网格" : "编辑网格";
 }
Esempio n. 2
0
        /// <summary>
        /// Save Grid.
        /// </summary>
        private void OKBtn_Click(object sender, EventArgs e)
        {
            try {
                if (String.IsNullOrWhiteSpace(GridNameTB.Text))
                {
                    GridNameTB.Focus();
                    MessageBox.Show("请输入网格名称", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (new Grid().ExistGridName(GridNameTB.Text.Trim()))
                {
                    GridNameTB.Focus();
                    MessageBox.Show("名称已存在", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                CurGrid = new IDValuePair <Int32, String>(CurGrid.ID, GridNameTB.Text.Trim());
                if (CurBehavior == EnmSaveBehavior.Add)
                {
                    new Grid().AddGrids(new List <IDValuePair <Int32, String> > {
                        CurGrid
                    });
                }
                else
                {
                    new Grid().UpdateGrids(new List <IDValuePair <Int32, String> > {
                        CurGrid
                    });
                }

                Common.WriteLog(DateTime.Now, CurBehavior == EnmSaveBehavior.Add ? EnmMsgType.Cardin : EnmMsgType.Info, Common.CurUser.UserName, "Delta.MPS.AccessSystem.SaveGridForm.SaveBtn.Click", String.Format("{0}网格:[{1}]", CurBehavior == EnmSaveBehavior.Add ? "新增" : "更新", CurGrid.Value), null);
                DialogResult = System.Windows.Forms.DialogResult.OK;
            } catch (Exception err) {
                Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.SaveCardForm.SaveBtn.Click", err.Message, err.StackTrace);
                MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Class Constructor
 /// </summary>
 public SaveStaGridForm(IDValuePair <Int32, String> Grid)
 {
     InitializeComponent();
     CurGrid = Grid;
     //Text = String.Format("添加\"{0}\"所含局站", CurGrid.Value);
 }
Esempio n. 4
0
        /// <summary>
        /// Setting Button Click
        /// </summary>
        protected void SettingButton_Click(object sender, DirectEventArgs e)
        {
            try {
                var value = 0;
                if (middisplay.Checked)
                {
                    value += int.Parse(middisplay.InputValue);
                }
                if (stafeaturesdisplay.Checked)
                {
                    value += int.Parse(stafeaturesdisplay.InputValue);
                }
                if (statypedisplay.Checked)
                {
                    value += int.Parse(statypedisplay.InputValue);
                }
                if (productordisplay.Checked)
                {
                    value += int.Parse(productordisplay.InputValue);
                }

                var current = new IDValuePair <string, int>(Page.User.Identity.Name, value);
                var param1  = new BUser().GetSysParams(50000001).Find(p => p.ParaData == 0);
                if (param1 == null)
                {
                    param1 = new SysParamInfo()
                    {
                        ID          = 14,
                        ParaCode    = 50000001,
                        ParaData    = 0,
                        ParaDisplay = null,
                        Note        = "用户Profile"
                    };
                }

                var displays = new List <IDValuePair <string, int> >()
                {
                    current
                };
                if (param1.ParaDisplay != null &&
                    !string.IsNullOrEmpty(param1.ParaDisplay.Trim()))
                {
                    var existings = Newtonsoft.Json.JsonConvert.DeserializeObject <List <IDValuePair <string, int> > >(param1.ParaDisplay);
                    if (existings != null)
                    {
                        foreach (var et in existings)
                        {
                            if (et.ID.Equals(current.ID, StringComparison.CurrentCultureIgnoreCase))
                            {
                                continue;
                            }

                            displays.Add(et);
                        }
                    }
                }

                param1.ParaDisplay = Newtonsoft.Json.JsonConvert.SerializeObject(displays);
                var userEntity = new BUser();
                userEntity.UpdateSysParams(new List <SysParamInfo>()
                {
                    param1
                });
                UserData.SysParams = userEntity.GetSysParams(WebUtility.DefaultInt32);
                WebUtility.ShowMessage(EnmErrType.Info, "数据保存完成");
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            }
        }
        /// <summary>
        /// Save Button Click Event.
        /// </summary>
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            try {
                if (TotalRecords.Count == 0)
                {
                    MessageBox.Show("暂无需要保存的记录", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (MessageBox.Show("您确定要保存吗?", "确认对话框", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK)
                {
                    var target = new CardAuthInfo();
                    target.BeginTime = BeginTimeDTP.Value;
                    target.EndTime   = EndTimeDTP.Value;
                    target.Password  = PwdCB.Text.Trim();
                    target.Enabled   = true;
                    var limitId = (Int32)LimitTypeCB.SelectedValue;
                    switch ((EnmLimitID)limitId)
                    {
                    case EnmLimitID.TQ:
                        target.LimitId    = EnmLimitID.TQ;
                        target.LimitIndex = ComUtility.DefaultInt32;
                        break;

                    case EnmLimitID.WTMG:
                        target.LimitId    = EnmLimitID.WTMG;
                        target.LimitIndex = Convert.ToInt32(LimitIndexCB.SelectedValue);
                        break;

                    case EnmLimitID.DTM:
                        target.LimitId    = EnmLimitID.DTM;
                        target.LimitIndex = Convert.ToInt32(LimitIndexCB.SelectedValue);
                        break;
                    }

                    var ids = new List <IDValuePair <Int32, String> >();
                    foreach (var tr in TotalRecords)
                    {
                        var id = new IDValuePair <Int32, String>(tr.Value2.RtuId, tr.Value2.CardSn);
                        ids.Add(id);
                    }

                    var result = Common.ShowWait(() => {
                        new CardAuth().UpdateBitchCardAuth(ids, target);
                    }, default(string), "正在保存,请稍后...", default(int), default(int), 1800);

                    if (result == DialogResult.OK)
                    {
                        foreach (var tr in TotalRecords)
                        {
                            Common.WriteLog(DateTime.Now, EnmMsgType.Info, Common.CurUser.UserName, "Delta.MPS.AccessSystem.BitchUpdateEndTimeForm.SaveBtn.Click", String.Format("更新卡片授权[设备:{0} 卡号:{1}]", tr.Value2.DevId, tr.Value2.CardSn), null);
                        }

                        BindAuthToGridView();
                        MessageBox.Show("数据保存完成", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("数据保存失败", "系统警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            } catch (Exception err) {
                Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.BitchUpdateEndTimeForm.SaveBtn.Click", err.Message, err.StackTrace);
                MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }