Esempio n. 1
0
        public IHttpActionResult UploadStoreSTLicense(string usCode, Guid Id)
        {
            var    files         = HttpContext.Current.Request.Files;
            var    file          = files[0];
            string fileName      = Path.GetFileName(file.FileName);
            string fileExtension = Path.GetExtension(file.FileName);
            string internalName  = Guid.NewGuid() + fileExtension;
            string absolutePath  = SiteFilePath.PMTAttachmentPath + "Common\\" + internalName;

            file.SaveAs(absolutePath);

            var license = StoreSTLicense.FirstOrDefault(store => store.Id == Id);

            if (license != null)
            {
                if (license.Status == null)
                {
                    license.CreateDate = DateTime.Now.ToString("yyyy-MM-dd");
                }
                license.Status     = 1;
                license.DocName    = fileName;
                license.ModifyDate = DateTime.Now.ToString("yyyy-MM-dd");
                license.Owner      = ClientCookie.UserNameENUS;
                license.FilePath   = SiteFilePath.PMTAttachmenttURL + "Common/" + internalName;

                license.Update();
            }
            return(Ok());
        }
Esempio n. 2
0
        public ActionResult StoreSTLicenseQuery(string _USCode)
        {
            List <StoreSTLicense> lsStoreSTLicense = new List <StoreSTLicense>();

            lsStoreSTLicense = StoreSTLicense.Search(o => o.StoreCode == _USCode).OrderBy(o => o.Title).ToList <StoreSTLicense>();

            if (lsStoreSTLicense.Count == 0)
            {
                var licenseList = new List <StoreSTLicense>();
                var store       = StoreBasicInfo.FirstOrDefault(i => i.StoreCode == _USCode);
                foreach (var dicItem in licenseDict)
                {
                    var storeLicense = new StoreSTLicense();
                    storeLicense.Id          = Guid.NewGuid();
                    storeLicense.StoreID     = store.StoreID;
                    storeLicense.StoreCode   = _USCode;
                    storeLicense.Title       = dicItem.Key;
                    storeLicense.CreatedTime = DateTime.Now;
                    storeLicense.DocType     = dicItem.Value;
                    licenseList.Add(storeLicense);
                }
                StoreSTLicense.Add(licenseList.ToArray());
                lsStoreSTLicense = licenseList;
            }

            string result = JsonConvert.SerializeObject(lsStoreSTLicense);

            return(Content(result));
        }
Esempio n. 3
0
        public IHttpActionResult Delete(Guid Id)
        {
            var result  = string.Empty;
            var license = StoreSTLicense.FirstOrDefault(store => store.Id == Id);

            if (license != null)
            {
                license.Status     = 2;
                license.DocName    = null;
                license.CreateDate = null;
                license.ModifyDate = null;
                license.EndDate    = null;
                license.Owner      = null;
                license.FilePath   = null;

                license.Update();

                result = license.StoreCode;
            }
            return(Ok(result));
        }