예제 #1
0
        private void InsertProject(DataTable dtProject)
        {
            foreach (DataRow row in dtProject.Rows)
            {
                string strId         = row["Index"].ToString();
                string strName       = row["Name"].ToString();
                string strManager    = row["ManagerName"].ToString();
                string strManagerTel = row["ManagerTel"].ToString();
                string strAddress    = row["Address"].ToString();
                string strRefOrg     = row["RefGroupName"].ToString();

                if (GroupBll.IsNameExist(strName))
                {
                    continue;
                }

                GlareSysEfDbAndModels.OrgInfo org = new GlareSysEfDbAndModels.OrgInfo()
                {
                    Address    = strAddress,
                    CreateDt   = DateTime.Now,
                    Id         = 0,
                    IsDel      = 0,
                    ManageName = strManager,
                    ManageTel  = strManagerTel,
                    Name       = strName,
                    UpdateDt   = DateTime.Now
                };
                string strError;
                OrgBll.AddAOrg(ref org, out strError);
            }
        }
예제 #2
0
        private void InsertNewOrg(DataTable dtOrg)
        {
            foreach (DataRow row in dtOrg.Rows)
            {
                string strId         = row["Index"].ToString();
                string strName       = row["Name"].ToString();
                string strManager    = row["ManagerName"].ToString();
                string strManagerTel = row["ManagerTel"].ToString();
                string strAddress    = row["Address"].ToString();

                if (OrgBll.IsNameExist(strName))
                {
                    continue;
                }

                GlareSysEfDbAndModels.OrgInfo org = new GlareSysEfDbAndModels.OrgInfo()
                {
                    Address    = strAddress,
                    CreateDt   = DateTime.Now,
                    Id         = 0,
                    IsDel      = 0,
                    ManageName = strManager,
                    ManageTel  = strManagerTel,
                    Name       = strName,
                    UpdateDt   = DateTime.Now
                };
            }
        }
예제 #3
0
        public ActionResult Modify(GlareSysEfDbAndModels.OrgInfo subject)
        {
            ResultHelper objResult = null;

            try
            {
                using (LedDb db = new LedDb())
                {
                    if (ModelState.IsValid)
                    {
                        OrgInfo aSubject = db.OrgInfo.Where(p => p.Id == subject.Id).FirstOrDefault();
                        aSubject.Name       = subject.Name;
                        aSubject.ManageName = subject.ManageName;
                        aSubject.Address    = subject.Address;
                        aSubject.ManageTel  = subject.ManageTel;
                        aSubject.UpdateDt   = DateTime.Now;
                        string strMsg = string.Empty;
                        bool   b      = OrgBll.UpdateProejct(ref subject, out strMsg);
                        if (b)
                        {
                            objResult = new ResultHelper()
                            {
                                Status = true,
                                Ret    = 0,
                                Obj    = subject,
                                Msg    = strMsg,
                                Desc   = strMsg
                            };
                        }
                        else
                        {
                            objResult = new ResultHelper()
                            {
                                Desc   = strMsg,
                                Msg    = strMsg,
                                Obj    = null,
                                Ret    = -1,
                                Status = false
                            };
                        }
                        //if (db.SaveChanges() > 0)
                        //{
                        //    objResult = new ResultHelper()
                        //    {
                        //        Status = true,
                        //        Ret = 0,
                        //        Obj = subject,
                        //        Msg = "Edit Success!",
                        //        Desc = "Edit Success!"
                        //    };
                        //}
                        //else
                        //{
                        //    objResult = new ResultHelper()
                        //    {
                        //        Desc = "Edit Faile,please try again.",
                        //        Msg = "Edit Faile,please try again.",
                        //        Obj = null,
                        //        Ret = -1,
                        //        Status = false
                        //    };
                        //}
                    }
                    else
                    {
                        objResult = new ResultHelper()
                        {
                            Desc   = " Faile,please try again",
                            Msg    = " Faile,please try again",
                            Obj    = null,
                            Ret    = -1,
                            Status = false
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                objResult = new ResultHelper()
                {
                    Desc   = ex.Message,
                    Msg    = ex.Message,
                    Obj    = null,
                    Ret    = -1,
                    Status = false
                };
            }
            return(Json(objResult));
        }
예제 #4
0
        public ActionResult Add(GlareSysEfDbAndModels.OrgInfo subject)
        {
            ResultHelper objResult = null;

            try
            {
                using (LedDb db = new LedDb())
                {
                    if (ModelState.IsValid)
                    {
                        subject.UpdateDt = DateTime.Now;
                        subject.CreateDt = DateTime.Now;
                        subject.IsDel    = 0;
                        string strMsg = string.Empty;
                        bool   b      = OrgBll.AddAOrg(ref subject, out strMsg);
                        if (b)
                        {
                            objResult = new ResultHelper()
                            {
                                Status = true,
                                Ret    = 0,
                                Obj    = subject,
                                Msg    = strMsg,
                                Desc   = strMsg
                            };
                        }
                        else
                        {
                            objResult = new ResultHelper()
                            {
                                Desc   = strMsg,
                                Msg    = strMsg,
                                Obj    = null,
                                Ret    = -1,
                                Status = false
                            };
                        }
                        //db.OrgInfo.Add(subject);
                        //if (db.SaveChanges() > 0)
                        //{
                        //    objResult = new ResultHelper()
                        //    {
                        //        Status = true,
                        //        Ret = 0,
                        //        Obj = subject,
                        //        Msg = "Add  Success!",
                        //        Desc = "Add  Success!"
                        //    };
                        //}
                        //else
                        //{
                        //    objResult = new ResultHelper()
                        //    {
                        //        Desc = "Add  Faile,please try again.",
                        //        Msg = "Add  Faile,please try again.",
                        //        Obj = null,
                        //        Ret = -1,
                        //        Status = false
                        //    };
                        //}
                    }
                    else
                    {
                        objResult = new ResultHelper()
                        {
                            Desc   = " Faile,please try again",
                            Msg    = " Faile,please try again",
                            Obj    = null,
                            Ret    = -1,
                            Status = false
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                objResult = new ResultHelper()
                {
                    Desc   = ex.Message,
                    Msg    = ex.Message,
                    Obj    = null,
                    Ret    = -1,
                    Status = false
                };
            }
            return(Json(objResult));
        }