Exemple #1
0
    protected void Grabar()
    {
        string strResultado = string.Empty;

        strResultado = ReglasNegocio();

        if (strResultado.Equals(string.Empty))
        {
            career objCareer = new career();

            objCareer.name        = this.txtName.Text;
            objCareer.description = this.txtDescription.Text;
            objCareer.is_enabled  = true;

            clsCarrera carrera = new clsCarrera();

            carrera.prCarrera = objCareer;
            strResultado      = carrera.AgregarCarrera();

            if (strResultado.Equals(string.Empty))
            {
                base.EnvioMensaje("Registro agregado correctamente.", 2, this.Manejador);
            }
            else
            {
                base.EnvioMensaje(strResultado, 1, this.Manejador);
            }
        }
        else
        {
            base.EnvioMensaje(strResultado, 1, this.Manejador);
        }
    }
Exemple #2
0
    protected void rdgCarreras_DeleteCommand(object sender, GridCommandEventArgs e)
    {
        try
        {
            string           strResultado = string.Empty;
            GridEditableItem ObjItem      = (GridEditableItem)e.Item;
            Hashtable        ObjHashtable = new Hashtable();
            career           objCareer    = new career();

            ObjItem.ExtractValues(ObjHashtable);

            objCareer.id = Convert.ToInt32(ObjHashtable["id"]);

            clsCarrera carrera = new clsCarrera();
            carrera.prCarrera = objCareer;

            strResultado = carrera.EliminarCarrera();

            if (string.IsNullOrEmpty(strResultado))
            {
                rdgCarreras.Rebind();
                base.EnvioMensaje("Registro eliminado correctamente.", 2, Manejador);
            }
            else
            {
                rdgCarreras.Rebind();
                base.EnvioMensaje(strResultado, 1, Manejador);
            }
        }
        catch (Exception ex)
        {
            base.EnvioMensaje("Error al eliminar datos.", 1, this.Manejador);
        }
    }
Exemple #3
0
    private string ReglasNegocio(career objCareer)
    {
        string strResultado = string.Empty;

        if (objCareer.name.Equals(string.Empty))
        {
            strResultado = "El campo nombre de carrera es obligatorio.";
        }

        return(strResultado);
    }
Exemple #4
0
    protected void rdgCarreras_UpdateCommand(object sender, GridCommandEventArgs e)
    {
        try
        {
            string           strResultado = string.Empty;
            GridEditableItem ObjItem      = (GridEditableItem)e.Item;
            Hashtable        ObjHashTable = new Hashtable();
            career           objCareer    = new career();

            ObjItem.ExtractValues(ObjHashTable);

            objCareer.id          = Convert.ToInt32(ObjHashTable["id"]);
            objCareer.name        = IsNull(ObjHashTable["name"]) ? "" : ObjHashTable["name"].ToString();
            objCareer.description = IsNull(ObjHashTable["description"]) ? "" : ObjHashTable["description"].ToString();

            strResultado = ReglasNegocio(objCareer);

            if (strResultado.Equals(string.Empty))
            {
                clsCarrera carrera = new clsCarrera();
                carrera.prCarrera = objCareer;

                strResultado = carrera.EditarCarrera();

                if (strResultado.Equals(string.Empty))
                {
                    base.EnvioMensaje("Datos actualizados correctamente.", 2, this.Manejador);
                    this.rdgCarreras.Rebind();
                }
                else
                {
                    base.EnvioMensaje(strResultado, 2, this.Manejador);
                }
            }
            else
            {
                base.EnvioMensaje(strResultado, 1, this.Manejador);
            }
        }
        catch (Exception ex)
        {
            this.rdgCarreras.MasterTableView.ClearEditItems();
            base.EnvioMensaje("Error al actualizar datos: " + ex.Message.ToString(), 1, this.Manejador);
        }
    }
        public ActionResult CareerDetail(CareerModel model)
        {
            using (var scope = new TransactionScope())
            {
                var career = _service.GetCareerById(model.Id);
                if (Equals(career, null))
                {
                    career = new career()
                    {
                        career_id    = 0,
                        created_date = ConvertDatetime.GetCurrentUnixTimeStamp()
                    };
                }
                career.type          = model.Type;
                career.city          = model.City;
                career.category_id   = model.CategoryId;
                career.salary_min    = model.SalaryMin;
                career.location      = model.Location;
                career.experied_date = model.ExpiredDate;
                _service.SaveCareer(career);

                int idx = 0;
                foreach (var careerContent in model.ContentList)
                {
                    var content = _service.GetCareerContentById(careerContent.Id);
                    if (Equals(content, null))
                    {
                        content = new career_content()
                        {
                            career_content_id = 0,
                            career_id         = career.career_id,
                            language          = idx
                        };
                    }
                    content.title   = careerContent.Title;
                    content.content = careerContent.Content;
                    _service.SaveCareerContent(content);
                    idx++;
                }

                scope.Complete();
            }
            return(RedirectToAction("Career"));
        }
    public string AgregarCarrera()
    {
        string strResultado = string.Empty;

        try
        {
            using (universityEntities DbContext = new universityEntities())
            {
                var CarreraExistente = DbContext.career.FirstOrDefault(x => (x.name == objCareer.name && (x.is_enabled == true || x.is_enabled == false)));

                if ((CarreraExistente != null) && (CarreraExistente.is_enabled == true))
                {
                    strResultado = String.Format("La Carrera: \"{0}\" ya está registrado en el sistema.", objCareer.name);
                }
                else if ((CarreraExistente != null) && (CarreraExistente.is_enabled == false))
                {
                    dynamic objUpdate = DbContext.career.First(x => (x.name == this.objCareer.name));

                    objUpdate.name        = this.objCareer.name;
                    objUpdate.description = this.objCareer.description;
                    objUpdate.is_enabled  = true;

                    DbContext.SaveChanges();
                }
                else
                {
                    career newCareer = new career();
                    newCareer = this.objCareer;

                    DbContext.career.Add(newCareer);
                    DbContext.SaveChanges();
                }
            }
        }
        catch (Exception e)
        {
            strResultado = "Error al guardar la carrera ingresada: " + e.Message.ToString();
        }

        return(strResultado);
    }
 public void SaveCareer(career career)
 {
     CareerRepository.Save(career);
 }
Exemple #8
0
        public static void SetInitListForEquipment()
        {
            if (itemTable != null && itemTable.Count > 0)
            {
                if (!itemTable.ContainsKey(table_equipment))
                {
                    return;
                }
                Hashtable parentTable = (Hashtable)itemTable [table_equipment];

                foreach (string stringkey in parentTable.Keys)
                {
                    //把每一行抓出來
                    Hashtable currenttable      = (Hashtable)parentTable[stringkey];
                    Equipment current_equipment = new Equipment();
                    int       count             = 0;
                    current_equipment.equipmentkey = stringkey;
                    equipmentType equipmenttype = equipmentType.cannotread;
                    switch (currenttable [key_equipment_type].ToString())
                    {
                    case "weapon":
                        equipmenttype = equipmentType.weapon;
                        break;

                    case "armor":
                        equipmenttype = equipmentType.armor;
                        break;

                    case "item":
                        equipmenttype = equipmentType.item;
                        break;

                    default:
                        break;
                    }
                    current_equipment.type    = equipmenttype;
                    current_equipment.tw      = Utilities.LoadString(currenttable [key_chinese], "");
                    current_equipment.tw_desc = Utilities.LoadString(currenttable [key_chinese_desc], "");
                    current_equipment.en      = Utilities.LoadString(currenttable [key_english], "");
                    current_equipment.en_desc = Utilities.LoadString(currenttable [key_english_desc], "");
                    Dictionary <string, int> data = new Dictionary <string, int>();
                    data = CheckIfKeyGotValue(data, currenttable, key_equipment_effect1, key_equipment_effect1count);
                    data = CheckIfKeyGotValue(data, currenttable, key_equipment_effect2, key_equipment_effect2count);
                    current_equipment.effect       = data;
                    current_equipment.picture_name = Utilities.LoadString(currenttable [key_picture], "");
                    current_equipment.price_value  = Utilities.LoadInt(currenttable [key_value], 0);
                    career career = career.cannotread;
                    switch (Utilities.LoadString(currenttable [key_equipment_career], ""))
                    {
                    case "all":
                        career = career.all;
                        break;

                    case "":
                        break;

                    default:
                        break;
                    }
                    current_equipment.usablecareer          = career;
                    current_equipment.picture_name          = Utilities.LoadString(currenttable[key_equipment_picturename], "");
                    current_equipment.thumbnailpicture_name = Utilities.LoadString(currenttable[key_equipment_thumbnailpicture], "");
                    Utilities.DebugLog("Equipment now is " + stringkey);
                    equipmentinfo_list.Add(current_equipment);
                }
            }
        }