Beispiel #1
0
 private void Edit(int id)
 {
     try
     {
         GuideBLL  guideBLL = new GuideBLL();
         DataTable dt       = guideBLL.GetById(id);
         if (dt != null)
         {
             if (dt.Rows.Count > 0)
             {
                 this.ModelId              = Convert.ToInt32(Convert.ToString(dt.Rows[0]["GuideId"]));
                 this.ModelCode            = Convert.ToString(dt.Rows[0]["GuideCode"]);
                 txtName.Text              = Convert.ToString(dt.Rows[0]["Name"]);
                 txtContactNumber.Text     = Convert.ToString(dt.Rows[0]["ContactNumber"]);
                 txtAddressLine1.Text      = Convert.ToString(dt.Rows[0]["AddressLine1"]);
                 txtAddressLine2.Text      = Convert.ToString(dt.Rows[0]["AddressLine2"]);
                 txtEmail.Text             = Convert.ToString(dt.Rows[0]["Email"]);
                 ddlLocation.SelectedValue = Convert.ToString(dt.Rows[0]["LocationId"]);
             }
         }
     }
     catch (Exception)
     {
         Alert(AlertType.Error, "Failed to edit.");
     }
 }
Beispiel #2
0
        public void start(SCApplication app)
        {
            vehicleBLL          = app.VehicleBLL;
            vehicleService      = app.VehicleService;
            segmentBLL          = app.SegmentBLL;
            addressesBLL        = app.AddressesBLL;
            guideBLL            = app.GuideBLL;
            cmdBLL              = app.CMDBLL;
            unitBLL             = app.UnitBLL;
            commObjCacheManager = app.getCommObjCacheManager();
            var vhs = app.getEQObjCacheManager().getAllVehicle();

            lineService = app.LineService;
            foreach (AVEHICLE vh in vhs)
            {
                vh.CommandComplete       += Vh_CommandComplete;
                vh.BatteryLevelChange    += Vh_BatteryLevelChange;
                vh.BatteryCapacityChange += Vh_BatteryCapacityChange;
            }

            //註冊各個Coupler的Status變化,在有其中一個有變化的時候要通知AGV目前所有coupler的狀態
            List <AUNIT> chargers = unitBLL.OperateCatch.loadUnits();

            foreach (AUNIT charger in chargers)
            {
                //charger.CouplerStatusChanged += Charger_CouplerStatusChanged;
                charger.CouplerHPSafetyChaged += Charger_CouplerHPSafetyChaged;
            }
        }
Beispiel #3
0
 protected void btnDelete_Command(object sender, CommandEventArgs e)
 {
     try
     {
         string id = Convert.ToString(e.CommandArgument);
         if (!string.IsNullOrEmpty(id))
         {
             GuideBLL guideBLL = new GuideBLL();
             Guides   guide    = new Guides();
             guide.GuideId = Convert.ToInt32(QuaintSecurityManager.Decrypt(id));
             if (guide.GuideId > 0)
             {
                 if (guideBLL.Delete(guide))
                 {
                     Alert(AlertType.Success, "Deleted successfully.");
                     LoadList();
                 }
                 else
                 {
                     Alert(AlertType.Error, "Failed to delete.");
                 }
             }
         }
     }
     catch (Exception)
     {
         Alert(AlertType.Error, "Failed to delete.");
     }
 }
Beispiel #4
0
 public void setDistanceWithTargetAdr(GuideBLL guideBLL, string targetAdr)
 {
     if (!guideBLL.IsRoadWalkable(this.ADR_ID, targetAdr))
     {
         DistanceWithTargetAdr = int.MaxValue;
     }
     else
     {
         DistanceWithTargetAdr = guideBLL.getGuideInfo(this.ADR_ID, targetAdr).totalCost;
     }
 }
Beispiel #5
0
 private void LoadList()
 {
     try
     {
         GuideBLL  guideBLL = new GuideBLL();
         DataTable dt       = guideBLL.GetAll();
         rptrList.DataSource = dt;
         rptrList.DataBind();
     }
     catch (Exception)
     {
         //throw;
     }
 }
Beispiel #6
0
        public void start(SCApplication app)
        {
            vehicleBLL          = app.VehicleBLL;
            vehicleService      = app.VehicleService;
            segmentBLL          = app.SegmentBLL;
            addressesBLL        = app.AddressesBLL;
            guideBLL            = app.GuideBLL;
            cmdBLL              = app.CMDBLL;
            unitBLL             = app.UnitBLL;
            commObjCacheManager = app.getCommObjCacheManager();
            var vhs = app.getEQObjCacheManager().getAllVehicle();

            foreach (AVEHICLE vh in vhs)
            {
                vh.CommandComplete       += Vh_CommandComplete;
                vh.BatteryLevelChange    += Vh_BatteryLevelChange;
                vh.BatteryCapacityChange += Vh_BatteryCapacityChange;
            }
        }
        private void LoadDashboardInfo()
        {
            try
            {
                //Total Guide
                GuideBLL guideBLL = new GuideBLL();
                DataTable dtGuide = guideBLL.GetAll();
                lblTotalGuide.Text = Convert.ToString(Convert.ToInt32(dtGuide.Rows.Count));

                //Total Event
                EventBLL eventBLL = new EventBLL();
                DataTable dtEvent = eventBLL.GetAll();
                lblTotalEvent.Text = Convert.ToString(Convert.ToInt32(dtEvent.Rows.Count));

                //Total Location
                LocationBLL locationBLL = new LocationBLL();
                DataTable dtLocation = locationBLL.GetAll();
                lblTotalLocation.Text = Convert.ToString(Convert.ToInt32(dtLocation.Rows.Count));

                //Total Hotel Reservation
                HotelReservationBLL hotelReservationBLL = new HotelReservationBLL();
                DataTable dtHotelReservation = hotelReservationBLL.GetAll();
                lblTotalHotelReservation.Text = Convert.ToString(Convert.ToInt32(dtHotelReservation.Rows.Count));

                //Total Registration
                RegistrationBLL registrationBLL = new RegistrationBLL();
                DataTable dtRegistration = registrationBLL.GetAll();
                lblTotalRegistration.Text = Convert.ToString(Convert.ToInt32(dtRegistration.Rows.Count));

                //Total Registration
                //SubscribeBLL subscribeBLL = new SubscribeBLL();
                //DataTable dtSubscribe = subscribeBLL.GetAll();
                //lblTotalSubscribe.Text = Convert.ToString(Convert.ToInt32(dtSubscribe.Rows.Count));
            }
            catch (Exception)
            {
                
                throw;
            }
        }
Beispiel #8
0
 private void GenerateCode()
 {
     try
     {
         QuaintLibraryManager lib = new QuaintLibraryManager();
         ModelCode = CodePrefix.Guide + "-" + lib.GetSixDigitNumber(1);
         GuideBLL  guideBLL = new GuideBLL();
         DataTable dt       = guideBLL.GetAll();
         if (dt != null)
         {
             if (dt.Rows.Count > 0)
             {
                 string[] lastCode       = dt.Rows[dt.Rows.Count - 1]["GuideCode"].ToString().Split('-');
                 int      lastCodeNumber = Convert.ToInt32(lastCode[1]);
                 ModelCode = CodePrefix.Guide + "-" + lib.GetSixDigitNumber(lastCodeNumber + 1);
             }
         }
     }
     catch (Exception)
     {
         Alert(AlertType.Error, "Failed to load.");
     }
 }
        private void LoadList(int locationId)
        {
            try
            {
                GuideBLL  guideBLL = new GuideBLL();
                DataTable dt       = new DataTable();

                if (locationId > 0)
                {
                    dt = guideBLL.GetByLocationId(locationId);
                }
                else
                {
                    dt = guideBLL.GetAllActive();
                }

                rptrList.DataSource = dt;
                rptrList.DataBind();
            }
            catch (Exception)
            {
                //throw;
            }
        }
Beispiel #10
0
        protected void btnActiveOrDeactive_Command(object sender, CommandEventArgs e)
        {
            try
            {
                string id = Convert.ToString(e.CommandArgument);
                if (!string.IsNullOrEmpty(id))
                {
                    GuideBLL  guideBLL = new GuideBLL();
                    DataTable dt       = guideBLL.GetById(Convert.ToInt32(QuaintSecurityManager.Decrypt(id)));
                    if (dt != null)
                    {
                        if (dt.Rows.Count > 0)
                        {
                            string actionStatus = "Updated";
                            Guides guide        = new Guides();
                            guide.GuideId       = Convert.ToInt32(Convert.ToString(dt.Rows[0]["GuideId"]));
                            guide.GuideCode     = Convert.ToString(dt.Rows[0]["GuideCode"]);
                            guide.Name          = Convert.ToString(dt.Rows[0]["Name"]);
                            guide.ContactNumber = Convert.ToString(dt.Rows[0]["ContactNumber"]);
                            guide.Email         = Convert.ToString(dt.Rows[0]["Email"]);
                            guide.AddressLine1  = Convert.ToString(dt.Rows[0]["AddressLine1"]);
                            guide.AddressLine2  = Convert.ToString(dt.Rows[0]["AddressLine2"]);
                            guide.IsActive      = Convert.ToBoolean(Convert.ToString(dt.Rows[0]["IsActive"]));
                            guide.CreatedDate   = (string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["CreatedDate"]))) ? (DateTime?)null : Convert.ToDateTime(Convert.ToString(dt.Rows[0]["CreatedDate"]));
                            guide.CreatedBy     = Convert.ToString(dt.Rows[0]["CreatedBy"]);
                            guide.CreatedFrom   = Convert.ToString(dt.Rows[0]["CreatedFrom"]);
                            guide.LocationId    = Convert.ToInt32(dt.Rows[0]["LocationId"]);

                            guide.UpdatedDate = DateTime.Now;
                            guide.UpdatedBy   = UserInfo;
                            guide.UpdatedFrom = StationInfo;

                            if (guide.IsActive)
                            {
                                guide.IsActive = false;
                                actionStatus   = "Deactivated";
                            }
                            else
                            {
                                guide.IsActive = true;
                                actionStatus   = "Activated";
                            }

                            if (guideBLL.Update(guide))
                            {
                                Alert(AlertType.Success, actionStatus + " successfully.");
                                LoadList();
                            }
                            else
                            {
                                Alert(AlertType.Error, "Failed to update.");
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                Alert(AlertType.Error, "Failed to process.");
            }
        }
Beispiel #11
0
        private void SaveAndUpdate()
        {
            try
            {
                if (string.IsNullOrEmpty(txtName.Text))
                {
                    Alert(AlertType.Warning, "Enter name.");
                    txtName.Focus();
                }
                else if (string.IsNullOrEmpty(txtContactNumber.Text))
                {
                    Alert(AlertType.Warning, "Enter contact number.");
                    txtContactNumber.Focus();
                }
                else if (string.IsNullOrEmpty(txtAddressLine1.Text))
                {
                    Alert(AlertType.Warning, "Enter address line 1.");
                    txtAddressLine1.Focus();
                }
                else if (ddlLocation.SelectedIndex < 1)
                {
                    Alert(AlertType.Warning, "Select location.");
                    ddlLocation.Focus();
                }
                else
                {
                    QuaintLibraryManager lib = new QuaintLibraryManager();
                    string Name          = Convert.ToString(txtName.Text);
                    string contactNumber = Convert.ToString(txtContactNumber.Text);
                    string email         = Convert.ToString(txtEmail.Text);
                    string addressLine1  = Convert.ToString(txtAddressLine1.Text);
                    string addressLine2  = Convert.ToString(txtAddressLine2.Text);
                    int    locationId    = Convert.ToInt32(ddlLocation.SelectedValue);

                    GuideBLL guideBLL = new GuideBLL();
                    if (this.ModelId > 0)
                    {
                        DataTable dt    = guideBLL.GetById(this.ModelId);
                        Guides    guide = new Guides();
                        guide.GuideId       = Convert.ToInt32(Convert.ToString(dt.Rows[0]["GuideId"]));
                        guide.GuideCode     = Convert.ToString(dt.Rows[0]["GuideCode"]);
                        guide.Name          = Convert.ToString(dt.Rows[0]["Name"]);
                        guide.ContactNumber = Convert.ToString(dt.Rows[0]["ContactNumber"]);
                        guide.Email         = Convert.ToString(dt.Rows[0]["Email"]);
                        guide.AddressLine1  = Convert.ToString(dt.Rows[0]["AddressLine1"]);
                        guide.AddressLine2  = Convert.ToString(dt.Rows[0]["AddressLine2"]);
                        guide.IsActive      = Convert.ToBoolean(Convert.ToString(dt.Rows[0]["IsActive"]));
                        guide.CreatedDate   = (string.IsNullOrEmpty(Convert.ToString(dt.Rows[0]["CreatedDate"]))) ? (DateTime?)null : Convert.ToDateTime(Convert.ToString(dt.Rows[0]["CreatedDate"]));
                        guide.CreatedBy     = Convert.ToString(dt.Rows[0]["CreatedBy"]);
                        guide.CreatedFrom   = Convert.ToString(dt.Rows[0]["CreatedFrom"]);
                        guide.LocationId    = Convert.ToInt32(Convert.ToString(dt.Rows[0]["LocationId"]));

                        guide.Name          = Name;
                        guide.ContactNumber = contactNumber;
                        guide.Email         = email;
                        guide.AddressLine1  = addressLine1;
                        guide.AddressLine2  = addressLine2;
                        guide.LocationId    = locationId;

                        guide.UpdatedDate = DateTime.Now;
                        guide.UpdatedBy   = this.UserInfo;
                        guide.UpdatedFrom = this.StationInfo;

                        if (guideBLL.Update(guide))
                        {
                            this.MultiEntryDisallow = true;
                            Alert(AlertType.Success, "Updated successfully.");
                            ClearFields();
                        }
                        else
                        {
                            Alert(AlertType.Error, "Failed to update.");
                        }
                    }
                    else
                    {
                        Guides guide = new Guides();
                        guide.GuideCode     = this.ModelCode;
                        guide.Name          = Name;
                        guide.ContactNumber = contactNumber;
                        guide.Email         = email;
                        guide.AddressLine1  = addressLine1;
                        guide.AddressLine2  = addressLine2;
                        guide.IsActive      = true;
                        guide.CreatedDate   = DateTime.Now;
                        guide.CreatedBy     = this.UserInfo;
                        guide.CreatedFrom   = this.StationInfo;
                        guide.LocationId    = locationId;

                        if (guideBLL.Save(guide))
                        {
                            Alert(AlertType.Success, "Saved successfully.");
                            ClearFields();
                            GenerateCode();
                        }
                        else
                        {
                            Alert(AlertType.Error, "Failed to save.");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Alert(AlertType.Error, ex.Message.ToString());
            }
        }