Example #1
0
        public bool Update(bool isWeb = false)
        {
            if (!JPermission.CheckPermission("BusManagment.Dictionary.JDictionary.Update"))
            {
                return(false);
            }

            JDataBase DB = new JDataBase();

            try
            {
                DB.setQuery("update dic set text = N'" + Text + "' output inserted.text where name = N'" + Name + "' and lang = N'" + Lang + "'");
                DataTable dt = DB.Query_DataTable();
                if (dt == null || dt.Rows.Count == 0)
                {
                    return(false);
                }
                ClassLibrary.JHistory jHistory = new ClassLibrary.JHistory();
                jHistory.Save("BusManagment.JDictionary", 0, 0, 0, 0, "ویرایش در لغت نامه ", "", 0);
                return(true);
            }
            catch
            {
                return(false);
            }
            finally
            {
                DB.Dispose();
            }
        }
Example #2
0
File: Bus.cs Project: CoolWirya/BS
 public bool Delete(bool isWeb = false)
 {
     ClassLibrary.JConnection C  = new ClassLibrary.JConnection();
     ClassLibrary.JDataBase   db = new ClassLibrary.JDataBase(C.GetConnection("Server02", 0));
     try
     {
         if (!JPermission.CheckPermission("BusManagment.Bus.JBus.Delete"))
         {
             return(false);
         }
         JBusTable AT = new JBusTable();
         AT.SetValueProperty(this);
         if (AT.Delete(db))
         {
             if (!isWeb)
             {
                 Nodes.Delete(Nodes.CurrentNode);
             }
             ClassLibrary.JHistory jHistory = new ClassLibrary.JHistory();
             jHistory.Save("BusManagment.JBus", AT.Code, 0, 0, 0, "حذف اتوبوس", "", 0);
             return(true);
         }
         else
         {
             return(false);
         }
     }
     finally
     {
         db.Dispose();
     }
 }
Example #3
0
        /// <summary>
        /// درج
        /// </summary>
        /// <returns></returns>
        public int Insert()
        {
            JDataBase db = new JDataBase();

            try
            {
                if (JPermission.CheckPermission("Automation.JSendExportInfo.Insert"))
                {
                    JSendExportInfoTable JLT = new JSendExportInfoTable();
                    JLT.SetValueProperty(this);
                    Code = JLT.Insert(db);
                    if (Code > 0)
                    {
                        return(Code);
                    }
                    return(0);
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                JSystem.Except.AddException(ex);
                return(0);
            }
            finally
            {
                db.Dispose();
            }
        }
Example #4
0
        public bool Delete(bool isWeb = false)
        {
            if (!JPermission.CheckPermission("BusManagment.Dictionary.JDictionary.Delete"))
            {
                return(false);
            }

            JDataBase DB = new JDataBase();

            try
            {
                DB.setQuery("delete from dic output deleted.*  where name = N'" + Name + "' and lang = N'" + Lang + "'");
                DataTable dt = DB.Query_DataTable();
                if (dt == null || dt.Rows.Count == 0)
                {
                    return(false);
                }
                ClassLibrary.JHistory jHistory = new ClassLibrary.JHistory();
                jHistory.Save("BusManagment.JDictionary", 0, 0, 0, 0, "حذف از لغت نامه ", "", 0);
                return(true);
            }
            catch
            {
                return(false);
            }
            finally
            {
                DB.Dispose();
            }
        }
Example #5
0
        public bool Insert(bool isWeb = false)
        {
            if (!JPermission.CheckPermission("BusManagment.Dictionary.JDictionary.Insert"))
            {
                return(false);
            }

            JDataBase DB = new JDataBase();

            try
            {
                DB.setQuery("insert into dic (name, text, lang) output inserted.* values(N'" + Name + "', N'" + Text + "', N'" + Lang + "')");
                DataTable dt = DB.Query_DataTable();
                if (dt == null || dt.Rows.Count == 0)
                {
                    return(false);
                }
                ClassLibrary.JHistory jHistory = new ClassLibrary.JHistory();
                jHistory.Save("BusManagment.JDictionary", 0, 0, 0, 0, "ثبت در لغت نامه ", "", 0);
                return(true);
            }
            catch
            {
                return(false);
            }
            finally
            {
                DB.Dispose();
            }
        }
Example #6
0
        /// <summary>
        /// حذف
        /// </summary>
        /// <returns></returns>
        public bool Delete()
        {
            JSendExportInfoTable PDT = new JSendExportInfoTable();
            JDataBase            Db  = new JDataBase();

            try
            {
                if (JPermission.CheckPermission("Automation.JSendExportInfo.Delete"))
                {
                    PDT.SetValueProperty(this);
                    if (PDT.Delete(Db))
                    {
                        return(true);
                    }
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                JSystem.Except.AddException(ex);
                return(false);
            }
            finally
            {
                Db.Dispose();
            }
        }
Example #7
0
File: Card.cs Project: CoolWirya/BS
        public static DataTable GetDataTable(int pCode = 0)
        {
            JDataBase DB = new JDataBase();

            try
            {
                string query = "select * from AUTCardType "
                               + " Where " + JPermission.getObjectSql("BusManagment.Card.JCards.GetDataTable", "AUTCardType.Code");
                if (pCode > 0)
                {
                    query += " AND  Code = " + pCode;
                }
                DB.setQuery(query);
                return(DB.Query_DataTable());
            }
            catch (Exception ex)
            {
                JSystem.Except.AddException(ex);
                return(null);
            }
            finally
            {
                DB.Dispose();
            }
        }
Example #8
0
 /// <summary>
 /// ویرایش
 /// </summary>
 /// <returns></returns>
 public bool Update(JDataBase Db, bool Send)
 {
     if (JPermission.CheckPermission("ArchivedDocuments.JRequestArchiveFile.Update"))
     {
         JRequestArchiveFileTable PDT = new JRequestArchiveFileTable();
         try
         {
             Db.beginTransaction("RequestArchiveFile");
             PDT.SetValueProperty(this);
             if (PDT.Update(Db))
             {
                 if (Send)
                 {
                     if (!(SendConfirm(Db, 999)))
                     {
                         Db.Rollback("RequestArchiveFile");
                         JMessages.Error("Send Not Successfuly ", "");
                     }
                     else
                     {
                         if (Db.Commit())
                         {
                             //Nodes.DataTable.Merge(JVacationHours.GetDataTable(Code));
                             return(true);
                         }
                     }
                 }
                 else
                 {
                     if (Db.Commit())
                     {
                         return(true);
                     }
                     else
                     {
                         Db.Rollback("RequestArchiveFile");
                         return(false);
                     }
                 }
             }
             Db.Rollback("RequestArchiveFile");
             return(false);
         }
         catch (Exception ex)
         {
             JSystem.Except.AddException(ex);
             Db.Rollback("RequestArchiveFile");
             return(false);
         }
         finally
         {
             if ((Send))
             {
                 Db.Dispose();
             }
             PDT.Dispose();
         }
     }
     return(false);
 }
Example #9
0
        public static DataTable GetDataTable(int pCode = 0)
        {
            if (!JPermission.CheckPermission("BusManagment.WorkOrder.JAUTVacations.GetDataTable"))
            {
                return(null);
            }
            JDataBase DB = new JDataBase();

            try
            {
                string query = @" Select AUTVacation.Code, DriverPCode, clsAllPerson .Name  , subdefine.name  VacationType
	                ,(Select Fa_date from StaticDates Where En_Date = CAST(FromDate As Date)) + ' - '+ CAST(CAST (FromDate As Time) AS varchar(5)) FromDate
	                ,(Select Fa_date from StaticDates Where En_Date = CAST(ToDate As Date)) + ' - '+ CAST(CAST (ToDate As Time) AS varchar(5)) ToDate
	                , Description 
	                from AUTVacation  
	                Inner Join clsAllPerson ON clsAllPerson .Code = AUTVacation .DriverPCode 
	                Inner Join subdefine  ON subdefine .Code = AUTVacation .VacationType  "    ;
                if (pCode > 0)
                {
                    query += " WHERE AUTVacation.Code = " + pCode;
                }
                DB.setQuery(query + " ORDER BY ToDate Desc ");
                return(DB.Query_DataTable());
            }
            catch (Exception ex)
            {
                JSystem.Except.AddException(ex);
                return(null);
            }
            finally
            {
                DB.Dispose();
            }
        }
Example #10
0
 /// <summary>
 /// حذف
 /// </summary>
 /// <returns></returns>
 public bool Delete()
 {
     if (JPermission.CheckPermission("ArchivedDocuments.JRequestArchiveFile.Delete"))
     {
         JDataBase Db = new JDataBase();
         JRequestArchiveFileTable PDT = new JRequestArchiveFileTable();
         try
         {
             PDT.SetValueProperty(this);
             if (PDT.Delete(Db))
             {
                 return(true);
             }
             return(false);
         }
         catch (Exception ex)
         {
             JSystem.Except.AddException(ex);
             return(false);
         }
         finally
         {
             PDT.Dispose();
             Db.Dispose();
         }
     }
     return(false);
 }
Example #11
0
File: Zone.cs Project: CoolWirya/BS
        public static DataTable GetDataTable(int pCode = 0)
        {
            JDataBase DB = new JDataBase();

            try
            {
                string query = "select *,(cast(Code as varchar) + ' - ' + Name)NameWithCode from AUTZone "
                               + " Where " + JPermission.getObjectSql("BusManagment.Zone.JZones.GetDataTable", "AUTZone.Code");
                if (pCode > 0)
                {
                    query += " AND  Code = " + pCode;
                }
                DB.setQuery(query);
                return(DB.Query_DataTable());
            }
            catch (Exception ex)
            {
                JSystem.Except.AddException(ex);
                return(null);
            }
            finally
            {
                DB.Dispose();
            }
        }
Example #12
0
        public bool Delete()
        {
            if (!JPermission.CheckPermission("BusManagment.WorkOrder.JShift.Delete"))
            {
                return(false);
            }
            if (CheckUsedInTariff())
            {
                JMessages.Error("این شیفت در احکام کار استفاده شده است و قابل حذف نیست.", "");
                return(false);
            }
            JShiftTable AT = new JShiftTable();

            AT.SetValueProperty(this);
            if (JMessages.Question("آیا میخواهید شیفت انتخاب شده حذف شود؟", "") == System.Windows.Forms.DialogResult.Yes)
            {
                if (AT.Delete())
                {
                    Nodes.Delete(Nodes.CurrentNode);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
Example #13
0
        public bool Delete(bool isWeb = false, JDataBase db = null)
        {
            if (!JPermission.CheckPermission("BusManagment.WorkOrder.JTariff.Delete"))
            {
                return(false);
            }
            TariffTable AT = new TariffTable();

            AT.SetValueProperty(this);
            if (isWeb || JMessages.Question("آیا میخواهید حکم انتخاب شده حذف شود؟", "") == System.Windows.Forms.DialogResult.Yes)
            {
                if (AT.Delete(db))
                {
                    if (!isWeb)
                    {
                        Nodes.Delete(Nodes.CurrentNode);
                    }
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
Example #14
0
        public static DataTable GetDataTableForComboBox(int pCode = 0, bool QueryType = false)
        {
            if (!JPermission.CheckPermission("BusManagment.Station.JStations.GetDataTable"))
            {
                return(null);
            }
            JDataBase DB = new JDataBase();

            try
            {
                string query = "";
                if (QueryType == false)
                {
                    query = @"
                                    
                SELECT 
	                                                    S.[Code]
	                                                    ,case when S.IMEI > 0 then concat(S.Name, ' ', N'(تابلو)') else S.Name end Name
	                                                    ,Z.Name AS 'ZoneName',StationCode,
                                                        isnull(cast(S.name as nvarchar(max)),N'نامشخص')+' ( '+
										
										                (select ss.LineCode1 from(SELECT DISTINCT LineCode1,als1.StationCode
                FROM [dbo].[AUTLineStation] als1
                CROSS APPLY (select (select cast(LineNumber as varchar) from autline where code = als2.LineCode) + ',' 
                              FROM [dbo].[AUTLineStation] als2
                              WHERE als1.StationCode = als2.StationCode 
                              FOR XML PATH('') ) D ( LineCode1 ))ss where ss.StationCode = S.Code)
										
										                +' ) ' as NameWCode
										                , (Select Name from subdefine Where Code = S.StationTypeCode ) StationType
								                        ,Cast(S.Lat AS nvarchar(50)) Lat,Cast(S.Lng AS nvarchar(50)) Lng ,S.[Address]
										                , properties .*
                                                    FROM AUTStation S
                                                    INNER JOIN AUTZone Z ON S.ZoneCode = Z.Code
									                Left JOIN [Propperty_ClassName_BusManagment.Station_1000002] properties ON properties .ObjectCode = S.Code
                                ";
                }
                else
                {
                    query = @" select Code,StationCode,Name,ZoneCode,Lat,Lng,IsTerminal from AutStation S ";
                }

                if (pCode > 0)
                {
                    query += " WHERE  S.Code = " + pCode;
                }
                DB.setQuery(query);
                return(DB.Query_DataTable());
            }
            catch (Exception ex)
            {
                JSystem.Except.AddException(ex);
                return(null);
            }
            finally
            {
                DB.Dispose();
            }
        }
Example #15
0
 public void ShowReportChartForm()
 {
     if (JPermission.CheckPermission("Bascol.JReport.JReportChartForm", true))
     {
         //JReportChartForm p = new JReportChartForm();
         //p.ShowDialog();
     }
 }
Example #16
0
 public void ShowReportMangerForm()
 {
     if (JPermission.CheckPermission("Bascol.JReport.ShowReportMangerForm", true))
     {
         JReportManagerForm p = new JReportManagerForm();
         p.ShowDialog();
     }
 }
Example #17
0
        public static string GetWebQuery()
        {
            string PermitionSql = " And " + JPermission.getObjectSql("BusManagment.Bus.JBuses.GetAllBusesOnly", "abf.BusCode");

            return(@"select abf.Code,abf.[Date],abf.StartTime,abf.EndTime,ab.BUSNumber,sdf.name FailureName,
                    abf.[Description],abf.InsertDate
                    from AUTBusFailure abf
                    left join AutBus ab on ab.Code = abf.BusCode
                    left join subdefine sdf on sdf.Code = abf.BusFailureCode
                    where 1 = 1 " + PermitionSql);
        }
Example #18
0
        public void ShowDialog()
        {
            if (!(JPermission.CheckPermission("Bascol.JTruck.ShowDialog")))
            {
                return;
            }

            JTruckForm LandForm = new JTruckForm();

            LandForm.State = JFormState.Insert;
            LandForm.ShowDialog();
        }
Example #19
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (!(JPermission.CheckPermission("Bascol.JConfigBascolForm.btnSave_Click")))
     {
         return;
     }
     if (JReport.SetBascoolNumber(Convert.ToInt32(cmbBascol.SelectedValue), cmbBascolType.SelectedIndex))
     {
         JMessages.Information(" با موفقیت ثبت شد ", "");
     }
     //Globals.JRegistry.Write("BascolNum", cmbBascol.SelectedValue);
     //Globals.JRegistry.Write("BascolType", cmbBascolType.Text);
 }
Example #20
0
        public int Insert(bool isWeb = false)
        {
            if (!JPermission.CheckPermission("BusManagment.LineSubsidy.JLineSubsidy.Insert"))
            {
                return(0);
            }
            JLineSubsidyTable LST = new JLineSubsidyTable();

            LST.SetValueProperty(this);
            Code = LST.Insert();
            ClassLibrary.JHistory jHistory = new ClassLibrary.JHistory();
            jHistory.Save("BusManagment.JLineSubsidy", Code, 0, 0, 0, "ثبت LineSubsidy", "", 0);
            return(Code);
        }
Example #21
0
        public int Insert(bool isweb = false)
        {
            if (!JPermission.CheckPermission("BusManagment.SMSDetails.JSMSDetails.Insert"))
            {
                return(0);
            }
            JSMSDetailsTable ST = new JSMSDetailsTable();

            ST.SetValueProperty(this);
            Code = ST.Insert(0, true);
            ClassLibrary.JHistory jHistory = new ClassLibrary.JHistory();
            jHistory.Save("BusManagment.JSMSDetails", Code, 0, 0, 0, "جزئیات SMS", "", 0);
            return(Code);
        }
Example #22
0
        public int Insert(bool isWeb = false)
        {
            if (!JPermission.CheckPermission("BusManagment.Shift.JShift.Insert"))
            {
                return(0);
            }
            ShiftTable AT = new ShiftTable();

            AT.SetValueProperty(this);
            Code = AT.Insert();
            ClassLibrary.JHistory jHistory = new ClassLibrary.JHistory();
            jHistory.Save("BusManagment.JShift", Code, 0, 0, 0, "ثبت شیفت", "", 0);
            return(Code);
        }
Example #23
0
        public int Insert(bool isweb = false)
        {
            if (!JPermission.CheckPermission("BusManagment.OnlineReader.OnlineReaderConfig.Insert"))
            {
                return(0);
            }
            OnlineReaderConfigTable ORC = new OnlineReaderConfigTable();

            ORC.SetValueProperty(this);
            Code = ORC.Insert(0, true);
            ClassLibrary.JHistory jHistory = new ClassLibrary.JHistory();
            jHistory.Save("BusManagment.OnlineReaderConfig", Code, 0, 0, 0, "تنظیمات کارتخوان آنلاین", "", 0);
            return(Code);
        }
Example #24
0
        public int Insert()
        {
            if (!JPermission.CheckPermission("BusManagment.Personel.JPersonel.Insert"))
            {
                return(0);
            }
            JPersonelTable AT = new JPersonelTable();

            AT.SetValueProperty(this);
            Code = AT.Insert();
            if (Code > 0)
            {
                Nodes.DataTable.Merge(JPersonels.GetDataTable(Code));
            }
            return(Code);
        }
Example #25
0
        public int Insert(bool IsWeb = false)
        {
            if (!JPermission.CheckPermission("BusManagment.SMSMaster.JSMSMaster.Insert"))
            {
                return(0);
            }
            JSMSMasterTable ST = new JSMSMasterTable();

            ST.SetValueProperty(this);
            Code = ST.Insert(0, true);
            ClassLibrary.JHistory jHistory = new ClassLibrary.JHistory();
            jHistory.Save("BusManagment.JSMSMaster", Code, 0, 0, 0, "ثبت کننده SMS", "", 0);


            return(Code);
        }
Example #26
0
        public int Insert(bool isWeb = false)
        {
            if (!JPermission.CheckPermission("BusManagment.SellerTicket.JSellerTicket.Insert"))
            {
                return(0);
            }
            JSellerTicketTable AT = new JSellerTicketTable();

            AT.SetValueProperty(this);
            Code = AT.Insert();
            if (Code > 0 && !isWeb)
            {
                Nodes.DataTable.Merge(JSellerTickets.GetDataTable(Code));
            }
            return(Code);
        }
Example #27
0
 public bool Delete()
 {
     if (!JPermission.CheckPermission("BusManagment.Personel.JPersonel.Delete"))
     {
         return(false);
     }
     if (JMessages.Question("آیا میخواهید پرسنل انتخاب شده حذف شود؟", "") == System.Windows.Forms.DialogResult.Yes)
     {
         JPersonelTable AT = new JPersonelTable();
         AT.SetValueProperty(this);
         if (AT.Delete())
         {
             Nodes.Delete(Nodes.CurrentNode);
             return(true);
         }
     }
     return(false);
 }
Example #28
0
        public int Insert(bool isWeb = false)
        {
            if (!JPermission.CheckPermission("BusManagment.Station.JStation.Insert"))
            {
                return(0);
            }
            StationTable AT = new StationTable();

            AT.SetValueProperty(this);
            Code = AT.Insert();
            if (Code > 0 && !isWeb)
            {
                Nodes.DataTable.Merge(JStations.GetDataTable(Code));
            }
            ClassLibrary.JHistory jHistory = new ClassLibrary.JHistory();
            jHistory.Save("BusManagment.JStation", Code, 0, 0, 0, "ثبت ایستگاه", "", 0);
            return(Code);
        }
Example #29
0
        public int Insert(bool isWeb = false)
        {
            if (!JPermission.CheckPermission("BusManagment.UserDynamicDashboard.JUserDynamicDashboard.Insert"))
            {
                return(0);
            }
            UserDynamicDashboardTable AT = new UserDynamicDashboardTable();

            AT.SetValueProperty(this);
            Code = AT.Insert();
            if (Code > 0 && !isWeb)
            {
                Nodes.DataTable.Merge(JUserDynamicDashboards.GetDataTable(Code));
            }
            ClassLibrary.JHistory jHistory = new ClassLibrary.JHistory();
            jHistory.Save("BusManagment.JUserDynamicDashboard", Code, 0, 0, 0, "ثبت اشخاص دارنده داشبورد", "", 0);
            return(Code);
        }
Example #30
0
        public static DataTable GetDataTable(int pCode = 0)
        {
            if (!JPermission.CheckPermission("BusManagment.Personel.JPersonels.GetDataTable"))
            {
                return(null);
            }
            JDataBase DB = new JDataBase();

            try
            {
                string query = @"SELECT [AUTPersonel].[Code] 
                    , clsPerson.Fam+ ' - ' + clsPerson.Name AS Name
                  ,[AUTPersonel].[PersonCode]
                  ,[CertificateNumber]
                  ,(Select Fa_Date From StaticDates Where En_Date = [CertificateExpirationDate]) [CertificateExpirationDate]
                  ,(Select Fa_Date From StaticDates Where En_Date = [CertificateDate]) [CertificateDate]
                  ,subdefineCer.name [CertificateType]
                  ,[PersonelCode]
                  ,subdefineSpe.name Specification
                  ,AUTFleet.Name Fleet
                  ,subdefineEmp.name EmployeeType
              FROM [dbo].[AUTPersonel]
              Inner Join clsPerson ON [AUTPersonel].PersonCode = clsPerson .Code
              Left Join AUTFleet ON AUTFleet .Code = [AUTPersonel].FleetCode
              Left Join subdefine subdefineSpe on subdefineSpe .Code = [AUTPersonel].[Specification]
              Left Join subdefine subdefineEmp on subdefineEmp .Code = [AUTPersonel].[EmployeeType]
              Left Join subdefine subdefineCer on subdefineCer .Code = [AUTPersonel].[CertificateType] ";
                if (pCode > 0)
                {
                    query += " Where [AUTPersonel].Code = " + pCode;
                }
                DB.setQuery(query);
                return(DB.Query_DataTable());
            }
            catch (Exception ex)
            {
                JSystem.Except.AddException(ex);
                return(null);
            }
            finally
            {
                DB.Dispose();
            }
        }