Exemplo n.º 1
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            cboRegion.ClearSelection();
            drpWoredaRegion.ClearSelection();
            drpWoredaZone.ClearSelection();
            drpWoredaZone.Items.Clear();
            drpZoneRegion.ClearSelection();
            txtAddRegion.Text   = txtAddWoreda.Text = txtAddZone.Text = string.Empty;
            gvWereda.DataSource = new DataTable();
            gvWereda.DataBind();
            gvZone.DataSource = new DataTable();
            gvZone.DataBind();

            if (rbZoneWoreda.SelectedValue == "1")//woreda
            {
                FillRegion(drpWoredaRegion);
                gvWereda.DataSource = ModelLocation.GetWoredaByName(txtLocationName.Text);
                gvWereda.DataBind();
            }
            else if (rbZoneWoreda.SelectedValue == "2")//zone
            {
                FillRegion(drpZoneRegion);
                gvZone.DataSource = ModelLocation.GetZoneByName(txtLocationName.Text);
                gvZone.DataBind();
            }
        }
Exemplo n.º 2
0
        void SaveWoreda(bool isNEW)
        {
            if (cboRegion.SelectedIndex <= 0)
            {
                Messages.SetMessage("Please select Region first!", WarehouseApplication.Messages.MessageType.Warning);
                UpdatePanel1.Update();
                return;
            }
            else if (gvZone.SelectedIndex < 0)
            {
                Messages.SetMessage("Please select Zone first!", WarehouseApplication.Messages.MessageType.Warning);
                UpdatePanel1.Update();
                return;
            }
            ModelLocation ml = new ModelLocation();

            ml.ID          = isNEW ? Guid.NewGuid() : new Guid(((Label)gvWereda.SelectedRow.FindControl("lblWoredaID")).Text.Trim());
            ml.Description = txtAddWoreda.Text.Trim();
            ml.RegionID    = new Guid(cboRegion.SelectedValue);
            ml.ZoneID      = new Guid(drpWoredaZone.SelectedValue);
            ml.WoredaID    = ml.ID;
            ml.Save();
            FillWorada();
            Messages.SetMessage("Location successfully updated!", WarehouseApplication.Messages.MessageType.Success);
            UpdatePanel1.Update();
        }
Exemplo n.º 3
0
        public ActionResult Edit(ModelLocation location, List <MultipleIngredient> ingredients)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    Dictionary <ModelIngredient, int> inventory = new Dictionary <ModelIngredient, int>();
                    foreach (var i in ingredients)
                    {
                        if (i.Quantity > 0)
                        {
                            inventory[i.Ingredient] = i.Quantity;
                        }
                    }
                    location.Inventory = inventory;
                    Repo.UpdateLocation(Mapper.Map(location));
                }

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 4
0
 protected void gvWereda_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     gvWereda.PageIndex  = e.NewPageIndex;
     gvWereda.DataSource = ModelLocation.GetWoreda(new Guid(((Label)gvZone.SelectedRow.FindControl("lblZoneID")).Text.Trim())
                                                   , new Guid(cboRegion.SelectedValue));
     gvWereda.DataBind();
 }
Exemplo n.º 5
0
 void FillZoneForWoreda(Guid Region)
 {
     drpWoredaZone.Items.Add("");
     drpWoredaZone.DataSource     = ModelLocation.GetZone(Region);
     drpWoredaZone.DataValueField = "ID";
     drpWoredaZone.DataTextField  = "Description";
     drpWoredaZone.DataBind();
 }
 public static string GetUserVisiblePathFromModelLocation(this ModelLocation modelLocation)
 {
     if (modelLocation.Type != ModelLocationType.Server)
     {
         throw new NotSupportedException("ERROR: GetUserVisiblePathFromModelLocation cannot handle non-server ModelLocations.");
     }
     return(string.Format("{0}{1}{2}{3}", "RSN://", modelLocation.CentralServer, Path.AltDirectorySeparatorChar, modelLocation.RelativePath.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)));
 }
 public ExportCredential(string hostId, string modelPath, string savePath)
 {
     HostIp           = hostId;
     SavePath         = savePath;
     ModelPath        = modelPath;
     TempTargetFolder = GetTempTargetFolder();
     UserName         = GetUserName();
     ModelLocation    = new ModelLocation(HostIp, ModelPath, ModelLocationType.Server);
 }
Exemplo n.º 8
0
 void FillRegion(DropDownList dr)
 {
     dr.Items.Clear();
     dr.Items.Add(new ListItem("- Please Select Region -", ""));
     dr.DataSource     = ModelLocation.GetRegion();
     dr.DataValueField = "ID";
     dr.DataTextField  = "Description";
     dr.DataBind();
 }
Exemplo n.º 9
0
        public List <ModelLocation> Get()
        {
            List <ModelLocation> lista  = new List <ModelLocation>();
            List <locations>     dbList = db.locations.ToList();

            foreach (locations loc in dbList)
            {
                ModelLocation ml = new ModelLocation(loc);
                lista.Add(ml);
            }

            return(lista);
        }
Exemplo n.º 10
0
        public List <ModelLocation> Get(string naziv)
        {
            List <ModelLocation> lista  = new List <ModelLocation>();
            List <locations>     dbList = db.locations.Where(x => x.loc_name.Equals(naziv)).ToList();

            foreach (locations loc in dbList)
            {
                ModelLocation ml = new ModelLocation(loc);
                lista.Add(ml);
            }

            return(lista);
        }
Exemplo n.º 11
0
        void SaveRegion(bool isNEW)
        {
            ModelLocation ml = new ModelLocation();

            ml.ID          = isNEW ? Guid.NewGuid() : new Guid(cboRegion.SelectedValue);
            ml.Description = txtAddRegion.Text.Trim();
            ml.RegionID    = ml.ID;
            ml.ZoneID      = null;
            ml.WoredaID    = null;
            ml.Save();
            Messages.SetMessage("Location successfully updated!", WarehouseApplication.Messages.MessageType.Success);
            UpdatePanel1.Update();
            FillRegion(cboRegion);
            txtAddRegion.Text = string.Empty;
        }
Exemplo n.º 12
0
        public List <ModelLocation> Get(int id)
        {
            List <ModelLocation> lista = new List <ModelLocation>();
            locations            loc   = null;

            loc = db.locations.Find(id);

            if (loc != null)
            {
                ModelLocation ml = new ModelLocation(loc);
                lista.Add(ml);
            }

            return(lista);
        }
Exemplo n.º 13
0
        protected void btnRemoveRegion_Click(object sender, EventArgs e)
        {
            DataTable dt = ModelLocation.GetZone(new Guid(cboRegion.SelectedValue));

            if (dt.Rows.Count > 0)
            {
                Messages.SetMessage("The Region contains " + dt.Rows.Count +
                                    " zone under it. Removing Region having one or more zone is not allowed!"
                                    , WarehouseApplication.Messages.MessageType.Error);
                UpdatePanel1.Update();
                return;
            }

            ModelLocation.DeleteLocation(new Guid(cboRegion.SelectedValue));
            FillRegion(cboRegion);
        }
Exemplo n.º 14
0
        protected void gvZone_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            DataTable dt = ModelLocation.GetWoreda(new Guid(((Label)gvZone.Rows[e.RowIndex].FindControl("lblZoneID")).Text.Trim())
                                                   , new Guid(cboRegion.SelectedValue));

            if (dt.Rows.Count > 0)
            {
                Messages.SetMessage("The zone contains " + dt.Rows.Count +
                                    " worada under it. Removing a zone having one or more worada is not allowed!"
                                    , WarehouseApplication.Messages.MessageType.Error);
                UpdatePanel1.Update();
                return;
            }

            ModelLocation.DeleteLocation(new Guid(((Label)gvZone.Rows[e.RowIndex].FindControl("lblZoneID")).Text));
            FillZone();
        }
Exemplo n.º 15
0
        void FillWorada()
        {
            gvWereda.DataSource = new DataTable();
            gvWereda.DataBind();

            drpWoredaZone.Items.Clear();

            if (gvZone.SelectedIndex >= 0 && drpZoneRegion.SelectedIndex > 0)
            {
                gvWereda.DataSource = ModelLocation.GetWoreda(new Guid(((Label)gvZone.SelectedRow.FindControl("lblZoneID")).Text.Trim())
                                                              , new Guid(drpZoneRegion.SelectedValue));
                gvWereda.DataBind();
                txtAddWoreda.Text = string.Empty;

                FillRegion(drpWoredaRegion);
                FillZoneForWoreda(new Guid(drpZoneRegion.SelectedValue));
                drpWoredaZone.SelectedValue   = ((Label)gvZone.SelectedRow.FindControl("lblZoneID")).Text.Trim();
                drpWoredaRegion.SelectedValue = drpZoneRegion.SelectedValue;
            }
        }
Exemplo n.º 16
0
        void FillZone()
        {
            gvZone.DataSource = new DataTable();
            gvZone.DataBind();

            drpZoneRegion.Items.Clear();

            gvWereda.DataSource = new DataTable();
            gvWereda.DataBind();

            drpWoredaZone.Items.Clear();

            if (cboRegion.SelectedIndex > 0)
            {
                string regionID = cboRegion.SelectedValue;
                Guid   reID     = new Guid(regionID);
                gvZone.DataSource = ModelLocation.GetZone(new Guid(cboRegion.SelectedValue));
                gvZone.DataBind();
                txtAddZone.Text = string.Empty;

                FillRegion(drpZoneRegion);
                drpZoneRegion.SelectedValue = cboRegion.SelectedValue;
            }
        }
Exemplo n.º 17
0
        public ModelLocation GetById(int id)
        {
            ModelLocation location = (ModelLocation)db.Location.First(i => i.Id == id);

            return(location);
        }
Exemplo n.º 18
0
 protected void gvWereda_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     ModelLocation.DeleteLocation(new Guid(((Label)gvWereda.Rows[e.RowIndex].FindControl("lblWoredaID")).Text));
     FillWorada();
 }
Exemplo n.º 19
0
 public void AddNew(ModelLocation location)
 {
     db.Location.InsertOnSubmit(location);
     db.SubmitChanges();
 }
Exemplo n.º 20
0
 protected void gvZone_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     gvZone.PageIndex  = e.NewPageIndex;
     gvZone.DataSource = ModelLocation.GetZone(new Guid(cboRegion.SelectedValue));
     gvZone.DataBind();
 }
Exemplo n.º 21
0
        public string GetById(int id)
        {
            ModelLocation location = LocationDAO.GetById(id);

            return(JsonHelpers.stringify(location));
        }