public int InsertOfficeType(OfficeType officeType)
        {
            try
            {
                int ReturnValue = 0;

                SqlCommand sqlCmd = new SqlCommand();
                sqlCmd.CommandType = CommandType.StoredProcedure;

                sqlCmd.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output;

                sqlCmd.Parameters.Add(GetParameter("@OfficeTypeName", SqlDbType.VarChar, officeType.OfficeTypeName));
                sqlCmd.Parameters.Add(GetParameter("@OfficeTypeDescription", SqlDbType.VarChar, officeType.OfficeTypeDescription));
                sqlCmd.Parameters.Add(GetParameter("@OfficeTypeAbbreviation", SqlDbType.VarChar, officeType.OfficeTypeAbbreviation));

                if (officeType.ParentOfficeTypeID > 0)
                {
                    sqlCmd.Parameters.Add(GetParameter("@ParentOfficeTypeID", SqlDbType.Int, officeType.ParentOfficeTypeID));
                }
                sqlCmd.Parameters.Add(GetParameter("@HierarchyIndex", SqlDbType.Int, officeType.HierarchyIndex));

                sqlCmd.Parameters.Add(GetParameter("@ComapnyID", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.CompanyID));
                sqlCmd.Parameters.Add(GetParameter("@AddedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID));

                sqlCmd.CommandText = "pADM_OfficeTypes_Insert";

                ExecuteStoredProcedure(sqlCmd);

                return(int.Parse(sqlCmd.Parameters[0].Value.ToString()));
            }
            catch (Exception ex)
            {
                throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex));
            }
        }
Пример #2
0
        public OfficeTypeDTO InsertOfficeType(OfficeTypeDTO data)
        {
            OfficeType dataToInsert = new OfficeType();

            dataToInsert = OfficeTypeRequestFormatter.ConvertRespondentInfoFromDTO(data);
            return(OfficeTypeRequestFormatter.ConvertRespondentInfoToDTO(_unitOfWork.OfficeTypeRepository.Create(dataToInsert)));
        }
        public IEnumerable <OfficeTypeModel> Index()
        {
            OfficeType officeType = new OfficeType(conStr);
            var        data       = officeType.Items();

            return(data);
        }
Пример #4
0
        public Office(string name, OfficeType type, bool top, int x, int y) : base(name)
        {
            Props.Add(new Desk(this, type, x - 1, top ? y - 3 : y + 3));

            DoorToHallway = new Door(this, Hallway.Instance, "the door", x, y);
            //DoorToHallway.DoorUsed += door => Player.Instance.ChangeLocation(door.To);
            Props.Add(DoorToHallway);

            InternalVerbs.Add(new Verb("Look around", s =>
            {
                var props = Props.Select(o => o.Name).ToArray();
                if (props.Length <= 0)
                {
                    return;
                }
                Game.Instace.OutputPane.Write("You are next to ");
                if (props.Length == 1)
                {
                    Game.Instace.OutputPane.Write(props.First() + ".");
                }
                else
                {
                    Game.Instace.OutputPane.Write(FormattedString.Join(", ", props.WithoutLast()));
                    Game.Instace.OutputPane.Write(new FormattedString(", and ") + props.Last() + ".");
                }
            }));
        }
Пример #5
0
        // POST: OfficeTypes/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see https://go.microsoft.com/fwlink/?LinkId=317598.
        public JsonResult CreateOfficeType(OfficeType officeType)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    int totalExistRows = db.OfficeTypes.Where(x => x.OfficeTypeName.Equals(officeType.OfficeTypeName)).Count();
                    if (totalExistRows > 0)
                    {
                        return(Json(new { StatusCode = HttpStatusCode.Found, StatusMessage = "Office Type already present" }, JsonRequestBehavior.AllowGet));
                    }
                    officeType.CreatedBy   = (Session["User"] as SessionEntity).UserID;
                    officeType.CreatedDate = DateTime.Now;
                    db.OfficeTypes.Add(officeType);
                    db.SaveChanges();
                    return(Json(new { StatusCode = HttpStatusCode.Created, StatusMessage = "Office Type Saved Successfully" }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception e)
            {
                return(Json(new { StatusCode = HttpStatusCode.MethodNotAllowed, StatusMessage = e.Message }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new { StatusCode = HttpStatusCode.MethodNotAllowed, StatusMessage = "Please enter required fields" }, JsonRequestBehavior.AllowGet));
        }
Пример #6
0
        public ActionResult DeleteConfirmed(int id)
        {
            OfficeType officeType = db.OfficeTypes.Find(id);

            db.OfficeTypes.Remove(officeType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        //Delete Internal Revenue Allotment
        public ActionResult DeleteOfficeType(FM_OfficeType_OfficeType model, int OfficeTypeID)
        {
            OfficeType tblOfficeType = (from e in TOSSDB.OfficeTypes where e.OfficeTypeID == OfficeTypeID select e).FirstOrDefault();

            TOSSDB.OfficeTypes.Remove(tblOfficeType);
            TOSSDB.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #8
0
 public PopulationDataEntry(String iName, OfficeType iType, EntityLeaderList iLeaderList)
 {
     Name = iName;
     EntityOffice lOffice = new EntityOffice();
     lOffice.Type = iType;
     lOffice.OfficialsList = iLeaderList;
     Offices.Add(lOffice);
 }
Пример #9
0
        public int UpdateOfficeType(OfficeTypeDTO data)
        {
            OfficeType dataToUpdate = new OfficeType();

            dataToUpdate = OfficeTypeRequestFormatter.ConvertRespondentInfoFromDTO(data);
            var response = _unitOfWork.OfficeTypeRepository.Update(dataToUpdate);

            return(response);
        }
        //Get Update Internal Revenue Allotment
        public ActionResult Get_UpdateOfficeType(FM_OfficeType_OfficeType model, int OfficeTypeID)
        {
            OfficeType tblOfficeType = (from e in TOSSDB.OfficeTypes where e.OfficeTypeID == OfficeTypeID select e).FirstOrDefault();

            model.getOfficeTypecolumns.OfficeTypeID   = tblOfficeType.OfficeTypeID;
            model.getOfficeTypecolumns.OfficeTypeName = tblOfficeType.OfficeTypeName;
            model.getOfficeTypecolumns.OfficeTypeCode = tblOfficeType.OfficeTypeCode;
            return(PartialView("_UpdateOfficeType", model));
        }
Пример #11
0
        public PopulationDataEntry(String iName, OfficeType iType, EntityLeaderList iLeaderList)
        {
            Name = iName;
            EntityOffice lOffice = new EntityOffice();

            lOffice.Type          = iType;
            lOffice.OfficialsList = iLeaderList;
            Offices.Add(lOffice);
        }
Пример #12
0
        // GET: OfficeTypes/Edit/5
        public ActionResult Edit(int?id)
        {
            OfficeType officeType = db.OfficeTypes.Find(id);

            if (officeType == null)
            {
                return(Json(new { StatusCode = HttpStatusCode.NoContent, StatusMessage = "Office Type not found" }, JsonRequestBehavior.AllowGet));
            }
            return(PartialView(officeType));
        }
        //Add Internal Revenue Allotment
        public JsonResult AddOfficeType(FM_OfficeType_OfficeType model)
        {
            OfficeType tblOfficeType = new OfficeType();

            tblOfficeType.OfficeTypeName = model.getOfficeTypecolumns.OfficeTypeName;
            tblOfficeType.OfficeTypeCode = model.getOfficeTypecolumns.OfficeTypeCode;
            TOSSDB.OfficeTypes.Add(tblOfficeType);
            TOSSDB.SaveChanges();
            return(Json(tblOfficeType));
        }
        //Update Internal Revenue Allotment
        public ActionResult UpdateOfficeType(FM_OfficeType_OfficeType model)
        {
            OfficeType tblOfficeType = (from e in TOSSDB.OfficeTypes where e.OfficeTypeID == model.getOfficeTypecolumns.OfficeTypeID select e).FirstOrDefault();

            tblOfficeType.OfficeTypeName = model.getOfficeTypecolumns.OfficeTypeName;
            tblOfficeType.OfficeTypeCode = model.getOfficeTypecolumns.OfficeTypeCode;
            TOSSDB.Entry(tblOfficeType);
            TOSSDB.SaveChanges();
            return(PartialView("_UpdateOfficeType", model));
        }
Пример #15
0
        /// <summary>
        ///  检测是否安装office
        /// </summary>
        /// <returns></returns>
        public static bool IsOfficeInstalled()
        {
            OfficeType officeType = ReadWordVersion();

            if (officeType != OfficeType.None)
            {
                return(true);
            }
            return(false);
        }
Пример #16
0
 public ActionResult Edit([Bind(Include = "OTId,OTName,OTCode,OTDesc")] OfficeType officeType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(officeType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("CreateandView"));
     }
     return(View(officeType));
 }
Пример #17
0
 public static int UpdateOfficeType(OfficeType officeType)
 {
     try
     {
         return(OfficeTypesDataAccess.GetInstance.UpdateOfficeType(officeType));
     }
     catch (Exception ex)
     {
         throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex));
     }
 }
 public int UpdateOfficeType(OfficeType TheOfficeType)
 {
     try
     {
         return(OfficeTypeIntegration.UpdateOfficeType(TheOfficeType));
     }
     catch (Exception ex)
     {
         throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex));
     }
 }
Пример #19
0
        public ActionResult Create([Bind(Include = "OTId,OTName,OTCode,OTDesc")] OfficeType officeType)
        {
            if (ModelState.IsValid)
            {
                db.OfficeTypes.Add(officeType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(officeType));
        }
Пример #20
0
        public static OfficeTypeModel OfficeTypeToOfficeTypeModel(OfficeType model)
        {
            var officeTypeModel = new OfficeTypeModel
            {
                Id             = model.Id,
                CreatedDate    = model.CreatedDate,
                OfficeTypeName = model.OfficeTypeName,
                UpdatedDate    = model.UpdatedDate
            };

            return(officeTypeModel);
        }
Пример #21
0
        public static OfficeType OfficeTypeModelToOfficeType(OfficeTypeModel model)
        {
            var officeType = new OfficeType
            {
                Id             = model.Id,
                CreatedDate    = model.CreatedDate,
                OfficeTypeName = model.OfficeTypeName,
                UpdatedDate    = model.UpdatedDate
            };

            return(officeType);
        }
Пример #22
0
            public Desk(Location parent, OfficeType type, int x, int y) : base(parent, "the desk", x, y)
            {
                _item = null;
                switch (type)
                {
                case OfficeType.Mug:
                    _item = new MugItem();
                    break;

                case OfficeType.Key:
                    _item = new KeyItem();
                    break;
                }
                _hasItem = _item != null;
                InternalVerbs.Add(new Verb(new FormattedString("Inspect ", "the desk".Magenta()), s =>
                {
                    Game.Instace.OutputPane.Write(
                        new FormattedString("There is nothing here but ",
                                            "a phone".Magenta(),
                                            " with no connection, ",
                                            "a computer".Magenta(),
                                            " with no power, and ",
                                            "various knick-knacks".Magenta(),
                                            " and ",
                                            "paperweights".Magenta(),
                                            ". "));
                    if (!_hasItem)
                    {
                        return;
                    }
                    Game.Instace.OutputPane.Write(new FormattedString("There is a ", _item.Name.Sections[0], " on ",
                                                                      "the desk.".Magenta()));
                    _pickUpItemVerb.Enabled = true;
                }));

                if (_item == null)
                {
                    return;
                }

                _pickUpItemVerb = new Verb("Pick up the " + _item.Name, s =>
                {
                    _hasItem = false;
                    InternalVerbs.Remove(_pickUpItemVerb);
                    Player.Instance.AddItem(_item);
                })
                {
                    Enabled = false
                };
                InternalVerbs.Add(_pickUpItemVerb);
            }
Пример #23
0
 // POST: OfficeTypes/Delete/5
 public JsonResult DeleteConfirmed(int id)
 {
     try
     {
         OfficeType officeType = db.OfficeTypes.Find(id);
         db.OfficeTypes.Remove(officeType);
         db.SaveChanges();
         return(Json(new { StatusCode = HttpStatusCode.Created, StatusMessage = "Office Type Deleted Successfully" }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception e)
     {
         return(Json(new { StatusCode = HttpStatusCode.MethodNotAllowed, StatusMessage = e.Message }, JsonRequestBehavior.AllowGet));
     }
 }
Пример #24
0
        // GET: OfficeTypes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OfficeType officeType = db.OfficeTypes.Find(id);

            if (officeType == null)
            {
                return(HttpNotFound());
            }
            return(View(officeType));
        }
Пример #25
0
        public ActionResult CreateandView(OfficeType OfficeTypes)
        {
            if (ModelState.IsValid)
            {
                db.OfficeTypes.Add(OfficeTypes);
                db.SaveChanges();
                return(RedirectToAction("CreateAndView", "OfficeTypes"));
            }
            List <OfficeType> objOfficeTypeList = new List <OfficeType>();

            objOfficeTypeList   = db.OfficeTypes.ToList();
            ViewBag.Designation = objOfficeTypeList;
            return(View(OfficeTypes));
        }
Пример #26
0
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.Append("ElectionYear = ");
            sb.AppendLine(ElectionYear.ToString());
            sb.Append("Party = ");
            sb.AppendLine(Party.ToString());
            sb.Append("OfficeType   = ");
            sb.AppendLine(OfficeType.ToString());
            sb.Append("OfficeId     = ");
            sb.AppendLine(OfficeId.ToString());
            sb.Append("Flow");
            sb.AppendLine(Flow.ToString());
            sb.AppendLine("--");

            return(sb.ToString());
        }
Пример #27
0
 // POST: OfficeTypes/Edit/5
 // To protect from overposting attacks, please enable the specific properties you want to bind to, for
 // more details see https://go.microsoft.com/fwlink/?LinkId=317598.
 public JsonResult UpdateOfficeTypes(OfficeType officeType)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(officeType).State = EntityState.Modified;
             officeType.UpdatedBy       = (Session["User"] as SessionEntity).UserID;
             officeType.UpdatedDate     = DateTime.Now;
             db.SaveChanges();
             return(Json(new { StatusCode = HttpStatusCode.Created, StatusMessage = "Office Type Updated Successfully" }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception e)
     {
         return(Json(new { StatusCode = HttpStatusCode.MethodNotAllowed, StatusMessage = e.Message }, JsonRequestBehavior.AllowGet));
     }
     return(Json(new { StatusCode = HttpStatusCode.MethodNotAllowed, StatusMessage = "Please enter required fields" }, JsonRequestBehavior.AllowGet));
 }
Пример #28
0
        public async Task <bool> AddOffice(OfficeAnnounceModel announce)
        {
            try
            {
                OfficeType officeType = await _dbContext.OfficeTypes.FindAsync(announce.OfficeTypeId);

                DateTime addedDate = DateTime.Now;

                Office unicodeAnnounce = await _dbContext.Offices.FindAsync(_dbContext.Offices.Max(c => c.Id));

                string unicode = (Int32.Parse(unicodeAnnounce.AnnounceUniqueCode) + 1).ToString();

                Office office = new Office(officeType, announce.OfficeLocation, 51)
                {
                    AnnounceAddedDate  = addedDate,
                    AnnounceTypeId     = announce.AnnounceTypeId,
                    Price              = announce.Price,
                    CityId             = announce.CityId,
                    Description        = announce.Description,
                    PersonTypeId       = announce.PersonTypeId,
                    Email              = announce.Email,
                    AnnounceUniqueCode = unicode,
                    PhoneNumber        = announce.PhoneNumber,
                    RSAnnounceTypeId   = announce.OfficeRSAnnounceTypeId
                };

                await _dbContext.Offices.AddAsync(office);

                //car files upload start
                AddDataPhoto(announce.Paths, office.Id, "lib/images/realestate/office", FindTable.Office);


                //car files upload end
                await _dbContext.SaveChangesAsync();
            }
            catch (Exception exp)
            {
                throw exp;
            }
            return(true);
        }
        public async Task <IActionResult> AddOfficeType(string name)
        {
            if (!String.IsNullOrEmpty(name))
            {
                try
                {
                    var officeType = new OfficeType
                    {
                        Name = name,
                    };

                    await _dbContext.OfficeTypes.AddAsync(officeType);

                    await _dbContext.SaveChangesAsync();

                    return(Json(officeType));
                }
                catch (Exception)
                {
                    return(Json("fail"));
                }
            }
            return(Json("fail"));
        }
Пример #30
0
        public static OfficeType ConvertFromDatarowToObject(DataRow dataRow)
        {
            try
            {
                OfficeType officeType = new OfficeType();

                if (dataRow != null)
                {
                    officeType.OfficeTypeID           = int.Parse(dataRow["OfficeTypeID"].ToString());
                    officeType.OfficeTypeName         = dataRow["OfficeTypeName"].ToString();
                    officeType.OfficeTypeDescription  = dataRow["OfficeTypeDescription"].ToString();
                    officeType.OfficeTypeAbbreviation = dataRow["OfficeTypeAbbreviation"].ToString();

                    if (dataRow["ParentOfficeTypeID"].ToString() != "")
                    {
                        officeType.ParentOfficeTypeID = int.Parse(dataRow["ParentOfficeTypeID"].ToString());
                        //officeType.ParentOfficeTypeName = dataRow["ParentOfficeTypeName"].ToString();
                    }
                    else
                    {
                        officeType.ParentOfficeTypeID   = -1;
                        officeType.ParentOfficeTypeName = "";
                    }

                    officeType.HierarchyIndex = (dataRow["HierarchyIndex"].ToString() == string.Empty? -1 : int.Parse(dataRow["HierarchyIndex"].ToString()));

                    officeType.IsActive  = (bool)dataRow["IsActive"];
                    officeType.IsDeleted = (bool)dataRow["IsDeleted"];
                }
                return(officeType);
            }
            catch (Exception ex)
            {
                throw (new Exception(MethodBase.GetCurrentMethod().DeclaringType.ToString() + "." + (new System.Diagnostics.StackFrame()).GetMethod().Name, ex));
            }
        }
Пример #31
0
 /// <summary>
 /// Kill the process of office
 /// </summary>
 /// <param name="type">The type of office: excel or word</param>
 /// <returns>The count of processes have been killed </returns>
 public static int Kill(OfficeType type)
 {
     return Kill(type, KillMode.All);
 }
 public static OfficeTypeDTO ConvertRespondentInfoToDTO(OfficeType officeType)
 {
     Mapper.CreateMap <OfficeType, OfficeTypeDTO>();
     return(Mapper.Map <OfficeType, OfficeTypeDTO>(officeType));
 }
Пример #33
0
 /// <summary>
 /// Kill the process of office
 /// </summary>
 /// <param name="type">The type of office: excel or word</param>
 /// <param name="mode">The mode of kill: confirm or not</param>
 /// <returns>The count of processes have been killed </returns>
 public static int Kill(OfficeType type, KillMode mode)
 {
     int killcount = 0;
     foreach (Process process in Process.GetProcesses())
     {
         if (string.Compare(process.ProcessName, type.ToString(), true) == 0)
         {
             if (mode == KillMode.Confirm)
             {
                 if (MessageBox.Show(string.Format("End {0} process:{1} ?", process.ProcessName, process.MainWindowTitle)
                     , "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                 {
                     continue;
                 }
             }
             try
             {
                 process.Kill();
                 killcount++;
             }
             catch (Exception e)
             {
                 MessageBox.Show(string.Format("{0} can not be stoped:\n{1}", process.ProcessName, e.Message)
                     , "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     return killcount;
 }