コード例 #1
0
        public string SaveCompany(string jsonString, string action)
        {
            try
            {
                CompanyInfoEntity  entity  = JsonConvert.DeserializeObject <CompanyInfoEntity>(jsonString);
                CompanyInfoManager manager = new CompanyInfoManager();
                if (action == "add")
                {
                    manager.Insert(entity);
                }
                else
                {
                    CompanyInfoEntity oldEntity = manager.GetCompanyInfoByCode(entity.Code);
                    oldEntity.Name        = entity.Name;
                    oldEntity.Address     = entity.Address;
                    oldEntity.Description = entity.Description;

                    oldEntity.UpdateBy = SessionHelper.CurrentUser.Code;

                    manager.Update(oldEntity);
                }
                return("success");
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }
コード例 #2
0
        public string PutCompanyInfo(CompanyInfoEntity entity)
        {
            try
            {
                if (entity == null)
                {
                    return("error");
                }

                CompanyInfoManager manager = new CompanyInfoManager();

                entity.CreateTime = DateTime.Now;
                entity.CreateTime = DateTime.Now;

                manager.Update(entity);

                return("success");
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }
コード例 #3
0
        public string DeleteCompanyInfo(int id)
        {
            try
            {
                CompanyInfoManager manager = new CompanyInfoManager();

                CompanyInfoEntity entity = manager.GetCompanyInfoByID(id);
                if (entity != null)
                {
                    entity.Valid      = "F";
                    entity.CreateTime = DateTime.Now;
                    entity.CreateTime = DateTime.Now;

                    manager.Update(entity);
                }

                return("success");
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }