Ejemplo n.º 1
0
        protected override void Edit()
        {
            try
            {
                if (TrafficGridView.CurrentRow != null && (Int64)TrafficGridView.CurrentRow.Cells[colTrafficID_bint.Name].Value != 0)
                {
                    HPS.BLL.TrafficBLL.BLLTraffic_TFactory TrafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
                    DataTable OutDataTable = new DataTable();
                    string    outcondition = "";
                    TrafficFactory.GetAllByConditionOut("", ref OutDataTable);
                    if ((Int64)TrafficGridView.CurrentRow.Cells[colTrafficID_bint.Name].Value != (Int64)TrafficGridView.CurrentRow.Cells[colMaxTrafficID_bint.Name].Value)
                    {
                        Hepsa.Core.Common.MessageBox.ErrorMessage("امکان احیای این خروج وجود ندارد ، این ناوگان ورود داشته است");
                        return;
                    }
                    if (Hepsa.Core.Common.MessageBox.ConfirmMessage("آیا از احیای این خروج اطمینان دارید؟") == true)
                    {
                        HPS.BLL.TrafficBLL.BLLTraffic_TFactory trafficFactory = new HPS.BLL.TrafficBLL.BLLTraffic_TFactory();
                        HPS.BLL.TrafficBLL.BLLTraffic_TKeys    trafficKey     = new HPS.BLL.TrafficBLL.BLLTraffic_TKeys();
                        trafficKey.TrafficID_bint = (Int64)TrafficGridView.CurrentRow.Cells[colTrafficID_bint.Name].Value;
                        string _LogBody = "<table border=\"1\">";
                        foreach (DataGridViewColumn col in TrafficGridView.Columns)
                        {
                            if (col.Visible)
                            {
                                _LogBody += string.Format("<tr><td>{0}</td><td>{1}</td></tr>", col.HeaderText, TrafficGridView.CurrentRow.Cells[col.Name].Value);
                            }
                        }
                        _LogBody += "</table>";

                        trafficFactory.BeginProc();
                        trafficFactory.Delete(trafficKey);
                        /********Start Logging********/
                        Hepsa.Core.BLL.BLLLog_TFactory LogFactory = new Hepsa.Core.BLL.BLLLog_TFactory();
                        Hepsa.Core.BLL.BLLLog_T        LogEntity  = new Hepsa.Core.BLL.BLLLog_T();
                        LogEntity.Date_nvc       = LogFactory.ServerJalaliDate;
                        LogEntity.Time_nvc       = LogFactory.ServerTime;
                        LogEntity.IPAddress_nvc  = Hepsa.Core.Common.ApplicationInfo.IpAddress;
                        LogEntity.MacAddress_nvc = Hepsa.Core.Common.ApplicationInfo.MacAddress;
                        LogEntity.UserName_nvc   = Hepsa.Core.Common.CurrentUser.User.UserName_nvc;
                        LogEntity.FormText_nvc   = String.IsNullOrEmpty(this.Text) ? this.Name : this.Text;
                        LogEntity.ActionID_int   = Convert.ToInt32(Hepsa.Core.BLL.BLLAction_T.Actions.Delete);
                        LogEntity.Body_nvc       = _LogBody;
                        LogFactory.Insert(LogEntity);
                        /********End Logging********/
                        trafficFactory.CommitProc();
                        this.LoadGrid();
                    }
                }
            }
            catch (Exception ex)
            {
                Hepsa.Core.Common.MessageBox.ErrorMessage(ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void makeLog()
        {
            Hepsa.Core.BLL.BLLLog_TFactory     logFatctory = new Hepsa.Core.BLL.BLLLog_TFactory();
            Hepsa.Core.BLL.BLLLog_T            logEntity   = new Hepsa.Core.BLL.BLLLog_T();
            Hepsa.Core.PL.BaseEntityParentForm BEPF        = new Hepsa.Core.PL.BaseEntityParentForm();
            logEntity.UserName_nvc   = HPS.Common.CurrentUser.user.UserName_nvc;
            logEntity.ActionID_int   = 8;
            logEntity.Date_nvc       = logFatctory.ServerJalaliDate;
            logEntity.Time_nvc       = logFatctory.ServerTime;
            logEntity.MacAddress_nvc = HPS.Common.FrequentlyUsedData.MacAddress();
            logEntity.IPAddress_nvc  = HPS.Common.FrequentlyUsedData.IpAddress();
            logEntity.Body_nvc       = "<TR><TD> نام کاربری </TD><TD>" + UserName_nvcTextBox.Text + "</TD></TR>";
            if (RememberMeCheckBox.Checked)
            {
                logEntity.Body_nvc += "<TR><TD> مرا به خاطر بسپار </TD><TD>√</TD></TR>";
            }
            //if (RememberMyPasswordCheckBox.Checked)
            //{
            //    logEntity.Body_nvc += "<TR><TD> گذر واژه مرا به خاطر بسپار </TD><TD>√</TD></TR>";
            //}

            logEntity.FormText_nvc = this.Text;
            logFatctory.Insert(logEntity);
        }