private bool CustomSaveOnEdit(T_Department t_department, out bool customsave_hasissues, string command = "")
        {
            var result = false;

            customsave_hasissues = false;
            return(result);
        }
        public ActionResult DeleteBulk(long[] ids, string UrlReferrer)
        {
            if (User != null && (!((CustomPrincipal)User).CanUseVerb("BulkDelete", "T_Department", User) || !User.CanDelete("T_Department")))
            {
                return(RedirectToAction("Index", "Error"));
            }
            bool customdelete_hasissues = false;

            foreach (var id in ids.Where(p => p > 0))
            {
                customdelete_hasissues = false;
                T_Department t_department = db.T_Departments.Find(id);
                if (CheckBeforeDelete(t_department))
                {
                    if (!CustomDelete(t_department, out customdelete_hasissues, "DeleteBulk"))
                    {
                        db.Entry(t_department).State = EntityState.Deleted;
                        db.T_Departments.Remove(t_department);
                        try
                        {
                            db.SaveChanges();
                        }
                        catch { }
                    }
                }
            }
            return(Json("Success", "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
        }
        private bool CustomSaveOnImport(T_Department t_department, out string customerror, int i)
        {
            var result = false;

            customerror = "";
            return(result);
        }
 public ActionResult DeleteConfirmed(T_Department t_department, string UrlReferrer)
 {
     if (!User.CanDelete("T_Department"))
     {
         return(RedirectToAction("Index", "Error"));
     }
     if (CheckBeforeDelete(t_department))
     {
         bool customdelete_hasissues = false;
         if (!CustomDelete(t_department, out customdelete_hasissues, "Delete"))
         {
             db.Entry(t_department).State = EntityState.Deleted;
             db.T_Departments.Remove(t_department);
             db.SaveChanges();
         }
         if (!customdelete_hasissues)
         {
             if (!string.IsNullOrEmpty(UrlReferrer))
             {
                 return(Redirect(UrlReferrer));
             }
             if (ViewData["T_DepartmentParentUrl"] != null)
             {
                 string parentUrl = ViewData["T_DepartmentParentUrl"].ToString();
                 ViewData["T_DepartmentParentUrl"] = null;
                 return(Redirect(parentUrl));
             }
             else
             {
                 return(RedirectToAction("Index"));
             }
         }
     }
     return(View(t_department));
 }
        public ActionResult CreateWizard([Bind(Include = "Id,ConcurrencyKey,T_DepartmentFacilityAssociationID,T_DEPTshort,T_DepartmentTitle")] T_Department t_department, string UrlReferrer)
        {
            CheckBeforeSave(t_department);
            if (ModelState.IsValid)
            {
                bool customcreate_hasissues = false;
                if (!CustomSaveOnCreate(t_department, out customcreate_hasissues, "Create"))
                {
                    db.T_Departments.Add(t_department);
                    db.SaveChanges();
                }
                if (!customcreate_hasissues)
                {
                    RedirectToRouteResult customRedirectAction = CustomRedirectUrl(t_department, "Create", "");
                    if (customRedirectAction != null)
                    {
                        return(customRedirectAction);
                    }
                    if (!string.IsNullOrEmpty(UrlReferrer))
                    {
                        return(Redirect(UrlReferrer));
                    }
                    else
                    {
                        return(RedirectToAction("Index"));
                    }
                }
            }

            LoadViewDataAfterOnCreate(t_department);
            ViewBag.T_DepartmentIsHiddenRule       = checkHidden("T_Department", "OnCreate", false);
            ViewBag.T_DepartmentIsGroupsHiddenRule = checkHidden("T_Department", "OnCreate", true);
            ViewBag.T_DepartmentIsSetValueUIRule   = checkSetValueUIRule("T_Department", "OnCreate");
            return(View(t_department));
        }
        private bool CustomDelete(T_Department t_department, out bool customdelete_hasissues, string command = "")
        {
            var result = false;

            customdelete_hasissues = false;
            return(result);
        }
        public ActionResult Details(int?id, string HostingEntityName, string AssociatedType, string defaultview)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            if (!CustomAuthorizationBeforeDetails(id, HostingEntityName, AssociatedType))
            {
                return(RedirectToAction("Index", "Error"));
            }
            T_Department t_department = db.T_Departments.Find(id);

            if (t_department == null)
            {
                return(HttpNotFound());
            }
            if (string.IsNullOrEmpty(defaultview))
            {
                defaultview = "Details";
            }
            GetTemplatesForDetails(defaultview);
            ViewData["AssociatedType"]    = AssociatedType;
            ViewData["HostingEntityName"] = HostingEntityName;
            LoadViewDataBeforeOnEdit(t_department);
            if (!string.IsNullOrEmpty(AssociatedType))
            {
                LoadViewDataForCount(t_department, AssociatedType);
            }
            ViewBag.T_DepartmentIsHiddenRule       = checkHidden("T_Department", "OnDetails", false);
            ViewBag.T_DepartmentIsGroupsHiddenRule = checkHidden("T_Department", "OnDetails", true);
            ViewBag.T_DepartmentIsSetValueUIRule   = checkSetValueUIRule("T_Department", "OnDetails");
            return(View(ViewBag.TemplatesName, t_department));
        }
Exemple #8
0
        public ActionResult ViewQuitEdit(int ID)
        {
            T_Quit MOD = db.T_Quit.Find(ID);

            if (MOD == null)
            {
                return(HttpNotFound());
            }
            //审批批号绑定
            ViewData["Code"] = MOD.Code;
            //用户花名绑定
            string Nickname = Server.UrlDecode(Request.Cookies["Nickname"].Value);
            string Name     = Server.UrlDecode(Request.Cookies["Name"].Value);

            ViewData["Nickname"] = Nickname;
            ViewData["Name"]     = Name;
            //用户部门绑定
            T_User       UserModel    = db.T_User.SingleOrDefault(a => a.Nickname == Nickname);
            int          DepartmentId = int.Parse(UserModel.DepartmentId);
            T_Department dModel       = db.T_Department.SingleOrDefault(a => a.ID == DepartmentId);

            ViewData["PostDepartment"] = dModel.Name;
            //一级审核人
            ViewData["FirstApprove"] = GetFisrtNameForApprove();
            ViewData["MyUser"]       = MOD.FirstApprove;
            //离职日期
            ViewData["Time"] = MOD.QuitTime;
            //我的固定资产
            ViewData["Assets"] = GetMyAssets(Name);
            //我的借支
            ViewData["Borrow"] = GetMyBorrow(Nickname);
            return(View(MOD));
        }
Exemple #9
0
        public static T_Department AddT_Department(T_Department t_Department)
        {
            string sql =
                "INSERT T_Department (depart_name, depart_addr, depart_status)" +
                "VALUES (@depart_name, @depart_addr, @depart_status)";

            sql += " ; SELECT @@IDENTITY";

            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@depart_name", DBHelper.GetValueByWhetherNull(t_Department.Depart_name)),
                    new SqlParameter("@depart_addr", DBHelper.GetValueByWhetherNull(t_Department.Depart_addr)),
                    new SqlParameter("@depart_status", DBHelper.GetValueByWhetherNull(t_Department.Depart_status))
                };

                int newId = DBHelper.GetScalar(sql, para);
                return(GetT_DepartmentById(newId));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Exemple #10
0
        public static void ModifyT_Department(T_Department t_Department)
        {
            string sql =
                "UPDATE T_Department " +
                "SET " +
                "depart_name = @depart_name, " +
                "depart_addr = @depart_addr, " +
                "depart_status = @depart_status " +
                "WHERE Id = @Id";


            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@Id", t_Department.Id),
                    new SqlParameter("@depart_name", DBHelper.GetValueByWhetherNull(t_Department.Depart_name)),
                    new SqlParameter("@depart_addr", DBHelper.GetValueByWhetherNull(t_Department.Depart_addr)),
                    new SqlParameter("@depart_status", DBHelper.GetValueByWhetherNull(t_Department.Depart_status))
                };

                DBHelper.ExecuteCommand(sql, para);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
Exemple #11
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            T_Department t_Department = await db.T_Department.FindAsync(id);

            db.T_Department.Remove(t_Department);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemple #12
0
        public async Task <ActionResult> Edit([Bind(Include = "DeptId,DeptName")] T_Department t_Department)
        {
            if (ModelState.IsValid)
            {
                db.Entry(t_Department).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(t_Department));
        }
Exemple #13
0
        /// <summary>
        /// 根据部门ID获取部门名称
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static string GetDepartmentName(int ID)
        {
            EBMSEntities db             = new EBMSEntities();
            string       DepartmentName = "";
            T_Department Department     = db.T_Department.Find(ID);

            if (Department != null)
            {
                DepartmentName = Department.Name;
            }
            return(DepartmentName);
        }
Exemple #14
0
        public async Task <ActionResult> Create([Bind(Include = "DeptId,DeptName")] T_Department t_Department)
        {
            if (ModelState.IsValid)
            {
                db.T_Department.Add(t_Department);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(t_Department));
        }
        public JsonResult Update(T_Department model)
        {
            bool   Success = false;
            string Message = "修改失败请联系管理员!";

            if (iDepartment.Edit(model) > 0)
            {
                Success = true;
                Message = "成功";
            }
            return(Json(new { Success = Success, Message = Message }, JsonRequestBehavior.AllowGet));
        }
Exemple #16
0
        private int StartProcessAsync(SysProcess process, int startUserId, int relativeObjectId, List <IApproveUser> nextApproveUserList)
        {
            int num3;

            try
            {
                int num = this._context.GetNextIdentity_Int(false);
                SysProcessInstance instance = new SysProcessInstance {
                    StartTime         = new DateTime?(DateTime.Now),
                    InstanceStatus    = 0,
                    ObjectId          = relativeObjectId,
                    ProcessId         = new long?(process.ProcessId),
                    ProcessInstanceId = num,
                    StartUserId       = new int?(startUserId)
                };
                if (process.ProcessCategory == 2)
                {
                    instance.FormInstanceId = new int?(relativeObjectId);
                    T_User user = this._context.FindById <T_User>(new object[] { startUserId });
                    if (user != null)
                    {
                        T_Department department = this._context.FindById <T_Department>(new object[] { user.Department_ID });
                        if (department != null)
                        {
                            instance.StartDeptId = new int?(department.Department_ID);
                        }
                    }
                }
                int num2 = this._context.GetNextIdentity_Int(false);
                SysWorkflowMessage msg = new SysWorkflowMessage {
                    ProcessId         = process.ProcessId,
                    ProcessInstanceId = num,
                    CreateTime        = DateTime.Now,
                    MessageId         = num2,
                    MessageType       = WorkflowMessageTypeEnum.StartingProcess,
                    OperationUserId   = startUserId,
                    State             = SysWorkflowMessageStateEnum.Inited
                };
                if ((nextApproveUserList != null) && (nextApproveUserList.Count > 0))
                {
                    msg.NextApproveUserList.AddRange(nextApproveUserList);
                }
                this.SaveWorkflowMessage(msg);
                this._context.Insert(instance);
                num3 = num;
            }
            catch (Exception exception)
            {
                AppLogHelper.Error(startUserId, exception, "启动流程[{0}]失败, 流程id={1}, 对象id={2}", new object[] { process.ProcessId, process.ProcessName, relativeObjectId });
                throw;
            }
            return(num3);
        }
        public string CheckBeforeSave(T_Department t_department, string command = "")
        {
            var AlertMsg = "";

            // Write your logic here

            //Make sure to assign AlertMsg with proper message
            //AlertMsg = "Validation Alert - Before Save !! Information not saved.";
            //ModelState.AddModelError("CustomError", AlertMsg);
            //ViewBag.ApplicationError = AlertMsg;
            return(AlertMsg);
        }
        public bool CheckBeforeDelete(T_Department t_department)
        {
            var result = true;

            // Write your logic here

            if (!result)
            {
                var AlertMsg = "Validation Alert - Before Delete !! Information not deleted.";
                ModelState.AddModelError("CustomError", AlertMsg);
                ViewBag.ApplicationError = AlertMsg;
            }
            return(result);
        }
Exemple #19
0
        // GET: T_Department/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            T_Department t_Department = await db.T_Department.FindAsync(id);

            if (t_Department == null)
            {
                return(HttpNotFound());
            }
            return(View(t_Department));
        }
    protected void updateUser_Click(object sender, EventArgs e)
    {
        DepartmentAdapter da   = new DepartmentAdapter();
        T_Department      item = new T_Department();

        item.Code = this.txt_code.Text.Trim();
        item.Name = this.txt_name.Text.Trim();
        if (string.IsNullOrEmpty(item.Code))
        {
            Label1.Text = "部门代码不能为空";
            return;
        }
        if (string.IsNullOrEmpty(item.Name))
        {
            Label1.Text = "部门名称不能为空";
            return;
        }
        if (string.IsNullOrEmpty(HiddenField1.Value))
        {
            //新增
            try
            {
                da.addDepartment(item);
                Label1.Text = "新增成功";
                init();
                GridViewBand();
            }
            catch (Exception ex)
            {
                Label1.Text = ex.Message;
            }
        }
        else
        {
            //更新
            item.Id = Int32.Parse(HiddenField1.Value);
            try
            {
                da.updateDepartment(item);
                Label1.Text = "保存成功";
                init();
                GridViewBand();
            }
            catch (Exception ex)
            {
                Label1.Text = ex.Message;
            }
        }
    }
        public ActionResult Create([Bind(Include = "Id,ConcurrencyKey,T_DepartmentFacilityAssociationID,T_DEPTshort,T_DepartmentTitle")] T_Department t_department, string UrlReferrer, bool?IsDDAdd)
        {
            string command = Request.Form["hdncommand"];

            CheckBeforeSave(t_department, command);

            if (ModelState.IsValid)
            {
                bool customcreate_hasissues = false;
                if (!CustomSaveOnCreate(t_department, out customcreate_hasissues, command))
                {
                    db.T_Departments.Add(t_department);
                    db.SaveChanges();
                }
                if (!customcreate_hasissues)
                {
                    RedirectToRouteResult customRedirectAction = CustomRedirectUrl(t_department, "Create", command);
                    if (customRedirectAction != null)
                    {
                        return(customRedirectAction);
                    }
                    if (command == "Create & Continue")
                    {
                        return(RedirectToAction("Edit", new { Id = t_department.Id, UrlReferrer = UrlReferrer }));
                    }
                    if (!string.IsNullOrEmpty(UrlReferrer))
                    {
                        return(Redirect(UrlReferrer));
                    }
                    else
                    {
                        return(RedirectToAction("Index"));
                    }
                }
            }

            if (IsDDAdd != null)
            {
                ViewBag.IsDDAdd = Convert.ToBoolean(IsDDAdd);
            }
            LoadViewDataAfterOnCreate(t_department);
            ViewData["T_DepartmentParentUrl"]      = UrlReferrer;
            ViewBag.T_DepartmentIsHiddenRule       = checkHidden("T_Department", "OnCreate", false);
            ViewBag.T_DepartmentIsGroupsHiddenRule = checkHidden("T_Department", "OnCreate", true);
            ViewBag.T_DepartmentIsSetValueUIRule   = checkSetValueUIRule("T_Department", "OnCreate");
            return(View(t_department));
        }
        public ActionResult BulkUpdate([Bind(Include = "Id,ConcurrencyKey,T_DepartmentFacilityAssociationID,T_DEPTshort,T_DepartmentTitle")] T_Department t_department, FormCollection collection, string UrlReferrer)
        {
            var bulkIds   = collection["BulkUpdate"].Split(',').ToList();
            var chkUpdate = collection["chkUpdate"];

            if (!string.IsNullOrEmpty(chkUpdate))
            {
                bool customsave_hasissues = false;
                foreach (var id in bulkIds.Where(p => p != string.Empty))
                {
                    long         objId  = long.Parse(id);
                    T_Department target = db.T_Departments.Find(objId);
                    target.setDateTimeToClientTime();
                    EntityCopy.CopyValuesForSameObjectType(t_department, target, chkUpdate);
                    customsave_hasissues = false;
                    CheckBeforeSave(target, "BulkUpdate");
                    if (ValidateModel(target) && !CustomSaveOnEdit(target, out customsave_hasissues, "BulkUpdate"))
                    {
                        db.Entry(target).State = EntityState.Modified;
                        try
                        {
                            if (target.t_departmentfacilityassociation != null)
                            {
                                db.Entry(target.t_departmentfacilityassociation).State = EntityState.Unchanged;
                            }
                            db.SaveChanges();
                        }
                        catch { }
                    }
                }
            }
            RedirectToRouteResult customRedirectAction = CustomRedirectUrl(t_department, "BulkUpdate", "");

            if (customRedirectAction != null)
            {
                return(customRedirectAction);
            }
            if (!string.IsNullOrEmpty(UrlReferrer))
            {
                return(Redirect(UrlReferrer));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
 //Delete a department in the database
 public void Delete(int id)
 {
     using (TimeTrackerEntities db = new TimeTrackerEntities())
     {
         try
         {
             T_Department t_department = new T_Department();
             t_department = db.T_Department.FirstOrDefault(d => d.Id == id);
             db.T_Department.Remove(t_department);
             db.SaveChanges();
         }
         catch (Exception ex)
         {
             string msg = ex.Message;
         }
     }
 }
Exemple #24
0
        public static T_Department GetT_DepartmentById(int id)
        {
            string sql = "SELECT * FROM T_Department WHERE Id = @Id";

            try
            {
                SqlDataReader reader = DBHelper.GetReader(sql, new SqlParameter("@Id", id));
                if (reader.Read())
                {
                    T_Department t_Department = new T_Department();

                    try{
                        t_Department.Id = (int)reader["Id"];
                    }catch
                    {}
                    try{
                        t_Department.Depart_name = (string)reader["depart_name"];
                    }catch
                    {}
                    try{
                        t_Department.Depart_addr = (string)reader["depart_addr"];
                    }catch
                    {}
                    try{
                        t_Department.Depart_status = (bool)reader["depart_status"];
                    }catch
                    {}

                    reader.Close();

                    return(t_Department);
                }
                else
                {
                    reader.Close();
                    return(null);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
 public ActionResult EditWizard([Bind(Include = "Id,ConcurrencyKey,T_DepartmentFacilityAssociationID,T_DEPTshort,T_DepartmentTitle")] T_Department t_department, string UrlReferrer)
 {
     CheckBeforeSave(t_department);
     if (ModelState.IsValid)
     {
         bool customsave_hasissues = false;
         if (!CustomSaveOnEdit(t_department, out customsave_hasissues, "Save"))
         {
             db.Entry(t_department).State = EntityState.Modified;
             db.SaveChanges();
         }
         if (!customsave_hasissues)
         {
             RedirectToRouteResult customRedirectAction = CustomRedirectUrl(t_department, "Edit", "");
             if (customRedirectAction != null)
             {
                 return(customRedirectAction);
             }
             if (!string.IsNullOrEmpty(UrlReferrer))
             {
                 var uri   = new Uri(UrlReferrer);
                 var query = HttpUtility.ParseQueryString(uri.Query);
                 if (Convert.ToBoolean(query.Get("IsFilter")) == true)
                 {
                     return(RedirectToAction("Index"));
                 }
                 else
                 {
                     return(Redirect(UrlReferrer));
                 }
             }
             else
             {
                 return(RedirectToAction("Index"));
             }
         }
     }
     LoadViewDataAfterOnEdit(t_department);
     ViewBag.T_DepartmentIsHiddenRule       = checkHidden("T_Department", "OnEdit", false);
     ViewBag.T_DepartmentIsGroupsHiddenRule = checkHidden("T_Department", "OnEdit", true);
     ViewBag.T_DepartmentIsSetValueUIRule   = checkSetValueUIRule("T_Department", "OnEdit");
     return(View(t_department));
 }
        public ActionResult BulkAssociate(long[] ids, string AssociatedType, string HostingEntity, string HostingEntityID)
        {
            var HostingID = Convert.ToInt64(HostingEntityID);

            if (HostingID == 0)
            {
                return(Json("Error", "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
            }
            if (HostingEntity == "T_Facility" && AssociatedType == "T_DepartmentFacilityAssociation")
            {
                foreach (var id in ids.Where(p => p > 0))
                {
                    T_Department obj = db.T_Departments.Find(id);
                    db.Entry(obj).State = EntityState.Modified;
                    obj.T_DepartmentFacilityAssociationID = HostingID;
                    db.SaveChanges();
                }
            }
            return(Json("Success", "application/json", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet));
        }
        public static T_DepartmentModel DTO(this T_Department node)
        {
            if (node == null)
            {
                return(null);
            }
            var model = new T_DepartmentModel()
            {
                Id        = node.Id,
                Name      = node.Name,
                CompanyId = node.CompanyId,
                UserId    = node.UserId,
                UserName  = node.UserName,
                //   Company = node.Company != null ? node.Company.DTO() : null, //公司表中已经有部门的子集,这里不能添加这行代码
                //  Users = node.Users != null ? node.Users.Select(s=>s.DTO).ToList(): null,
                Users = node.Users.Count > 0 ? node.Users.ToList().Select(s => s.DTO()).ToList() : null,
            };

            return(model);
        }
        public virtual IUser GetDepartmentManager(int departmentId)
        {
            IUser user2;

            try
            {
                T_Department dept = this.GetDept(departmentId);
                if ((dept != null) && dept.Manager_ID.HasValue)
                {
                    return(this.GetUser(dept.Manager_ID.Value));
                }
                user2 = null;
            }
            catch (Exception exception)
            {
                AppLogHelper.Error(exception);
                throw exception;
            }
            return(user2);
        }
Exemple #29
0
        public ActionResult ViewJoinedEdit(int ID)
        {
            T_Joined model = db.T_Joined.Find(ID);

            if (model == null)
            {
                return(HttpNotFound());
            }
            ViewData["Code"] = model.Code;
            //用户花名绑定
            string Nickname = Server.UrlDecode(Request.Cookies["Nickname"].Value);

            ViewData["Nickname"] = Nickname;
            //用户部门绑定
            T_User       UserModel    = db.T_User.SingleOrDefault(a => a.Nickname == Nickname);
            int          DepartmentId = int.Parse(UserModel.DepartmentId);
            T_Department dModel       = db.T_Department.SingleOrDefault(a => a.ID == DepartmentId);

            ViewData["PostDepartment"] = dModel.Name;
            //性别下拉框
            List <SelectListItem> SexOptions = new List <SelectListItem>();

            SexOptions.Add(new SelectListItem {
                Text = "男", Value = "男"
            });
            SexOptions.Add(new SelectListItem {
                Text = "女", Value = "女"
            });
            ViewData["Sex"] = SexOptions;
            //一级审核人
            ViewData["FirstApprove"] = GetFisrtNameForApprove();
            if (dModel.supervisor != null)
            {
                int    supervisorID    = int.Parse(dModel.supervisor.ToString());
                T_User supervisorModel = db.T_User.Find(supervisorID);
                ViewData["MyUser"] = supervisorModel.Name;
            }
            ViewData["modelSex"]          = model.Sex;
            ViewData["modelFirstApprove"] = model.FirstApprove;
            return(View(model));
        }
        public virtual bool IsRootDepartment(int departmentId)
        {
            bool flag2;

            try
            {
                bool         flag = false;
                T_Department dept = this.GetDept(departmentId);
                if (!(dept.Parent_ID.HasValue && (dept.Parent_ID.Value != 0)))
                {
                    flag = true;
                }
                flag2 = flag;
            }
            catch (Exception exception)
            {
                AppLogHelper.Error(exception);
                throw exception;
            }
            return(flag2);
        }
Exemple #31
0
        private static List <T_Department> GetT_DepartmentsBySql(string sql, params SqlParameter[] values)
        {
            List <T_Department> list = new List <T_Department>();

            try
            {
                DataTable table = DBHelper.GetDataSet(sql, values);

                foreach (DataRow row in table.Rows)
                {
                    T_Department t_Department = new T_Department();

                    try{
                        t_Department.Id = (int)row["Id"];
                    }catch
                    {}
                    try{
                        t_Department.Depart_name = (string)row["depart_name"];
                    }catch
                    {}
                    try{
                        t_Department.Depart_addr = (string)row["depart_addr"];
                    }catch
                    {}
                    try{
                        t_Department.Depart_status = (bool)row["depart_status"];
                    }catch
                    {}

                    list.Add(t_Department);
                }

                return(list);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
        }
 /// <summary>
 /// 创建新的 T_Department 对象。
 /// </summary>
 /// <param name="id">Id 的初始值。</param>
 public static T_Department CreateT_Department(int id)
 {
     T_Department t_Department = new T_Department();
     t_Department.Id = id;
     return t_Department;
 }
 /// <summary>
 /// 架构中不存在 T_Department 的注释。
 /// </summary>
 public void AddToT_Department(T_Department t_Department)
 {
     base.AddObject("T_Department", t_Department);
 }
 //Parsing done before Updating record in the database
 private void UpdateParse(T_Department t_department, Department department)
 {
     t_department.Description = department.Description;
     t_department.LastUpdateDate = department.LastUpdateDate;
     t_department.LastUpdatedBy = department.LastUpdatedBy;
     t_department.Position = department.Position;
     t_department.Acronym = department.Acronym;
 }
 //Parsing done before Inserting record in the database
 private T_Department InsertParse(Department department)
 {
     T_Department t_department = new T_Department();
     t_department.Description = department.Description;
     t_department.CreateDate = department.CreateDate;
     t_department.LastUpdateDate = department.LastUpdateDate;
     t_department.CreatedBy = department.CreatedBy;
     t_department.LastUpdatedBy = department.LastUpdatedBy;
     t_department.Position = department.Position;
     t_department.Acronym = department.Acronym;
     return t_department;
 }