Esempio n. 1
0
        public bool Update(bool isWeb = false, bool checkPermission = false)
        {
            bool hasPermission = true;

            if (checkPermission)
            {
                hasPermission = ClassLibrary.JPermission.CheckPermission("AVL.RegisterDevice.JRegisterDevice.Update");
            }
            if (!hasPermission)
            {
                return(false);
            }
            JRegisterDeviceTable AT = new JRegisterDeviceTable();

            AT.SetValueProperty(this);
            if (AT.Update())
            {
                try
                {
                }
                catch (Exception e)
                {
                    ClassLibrary.JHistory jHistory = new ClassLibrary.JHistory();
                    jHistory.Save("AVL.RegisterDevice.JRegisterDevice", AT.Code, 0, 0, 0, "ویرایش دستگاه", "", 0);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        public bool Delete(bool isWeb = false)
        {
            if (!ClassLibrary.JPermission.CheckPermission("AVL.RegisterDevice.JRegisterDevice.Delete"))
            {
                return(false);
            }

            ClassLibrary.JDataBase DB = new ClassLibrary.JDataBase();
            DB.setQuery("delete from AVLCoordinate where DeviceCode=" + Code.ToString());
            DB.Query_Execute(true);

            JRegisterDeviceTable AT = new JRegisterDeviceTable();

            AT.SetValueProperty(this);
            if (AT.Delete())
            {
                if (!isWeb)
                {
                    Nodes.Delete(Nodes.CurrentNode);
                }
                ClassLibrary.JHistory jHistory = new ClassLibrary.JHistory();
                jHistory.Save("AVL.RegisterDevice.JRegisterDevice", AT.Code, 0, 0, 0, "حذف دستگاه", "", 0);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
        public int Insert(decimal taxPercent, decimal DeviceRegisterPrice, bool isWeb = false)
        {
            if (!ClassLibrary.JPermission.CheckPermission("AVL.RegisterDevice.JRegisterDevice.Insert"))
            {
                return(0);
            }
            this.active = false;
            JRegisterDeviceTable AT = new JRegisterDeviceTable();

            AT.SetValueProperty(this);
            Code = AT.Insert();

            decimal Total = 0;

            //Insert factor
            Accounting.Factor.JFactor factor = new Accounting.Factor.JFactor();
            factor.RegisterDate = DateTime.Now;
            factor.userCode     = WebClassLibrary.SessionManager.Current.MainFrame.CurrentUserCode;
            factor.payState     = false;
            //insert active factorItem
            Accounting.Factor.FactorItem.JFactorItem item = new Accounting.Factor.FactorItem.JFactorItem();
            item.count      = 1;
            item.describe   = "هزینه فعال کردن";
            item.product    = 1;
            item.FactorCode = factor.Insert();
            Total           = item.TotalUnitPrice = item.unitPrice = DeviceRegisterPrice;
            item.Insert();
            ////insert charge factorItem
            item.describe = "هزینه شارژ سی روز";
            AVL.Device.JDeviceModel m = new AVL.Device.JDeviceModel();
            m.GetData(this.DeviceType.ToString());
            item.unitPrice = (decimal)m.UnitPrice;
            item.count     = 30;
            Total         += item.TotalUnitPrice = 30 * item.unitPrice;
            item.Insert();
            factor.Tax      = taxPercent * Total / 100;
            factor.Total    = Total + factor.Tax;
            factor.Discount = 0;
            factor.Update();

            ClassLibrary.JHistory jHistory = new ClassLibrary.JHistory();
            jHistory.Save("AVL.RegisterDevice.JRegisterDevice", Code, 0, 0, 0, "ثبت دستگاه", "", 0);
            if (Code > 0 && !isWeb)
            {
                Nodes.DataTable.Merge(JRegisterDevices.GetDataTable(true, "", Code));
            }

            ClassLibrary.JException j = ClassLibrary.JCore.Except;
            //   foreach (Exception ex in ClassLibrary.JSystem.Except)
            //  {
            //       Exception e = ex;
            //   }

            return(Code);
        }
Esempio n. 4
0
        public int Insert(bool isWeb = false, bool checkPermission = true)
        {
            bool hasPermission = true;

            if (checkPermission)
            {
                hasPermission = ClassLibrary.JPermission.CheckPermission("AVL.RegisterDevice.JRegisterDevice.Insert");
            }
            if (!hasPermission)
            {
                return(0);
            }
            JRegisterDeviceTable AT = new JRegisterDeviceTable();

            AT.SetValueProperty(this);
            Code = AT.Insert();


            ClassLibrary.JHistory jHistory = new ClassLibrary.JHistory();
            jHistory.Save("AVL.RegisterDevice.JRegisterDevice", Code, 0, 0, 0, "ثبت دستگاه", "", 0);

            try { if (Code > 0 && !isWeb && Nodes != null)
                  {
                      Nodes.DataTable.Merge(JRegisterDevices.GetDataTable(true, "", Code));
                  }
            }
            catch
            {
            }
            ClassLibrary.JException j = ClassLibrary.JCore.Except;
            //   foreach (Exception ex in ClassLibrary.JSystem.Except)
            //  {
            //       Exception e = ex;
            //   }

            return(Code);
        }