コード例 #1
0
ファイル: CASController.cs プロジェクト: giagiigi/ChemCloud
        public ActionResult Details(int cid)
        {
            CASInfo cas = new CASInfo();

            cas = ServiceHelper.Create <ICASInfoService>().GetCASInfoByCid(cid);
            return(View(cas));
        }
コード例 #2
0
        /// <summary>
        /// 产品-供应商列表页 视图
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Search_Product_Shops(string id)
        {
            int i;
            int k = 0;

            if (int.TryParse(id, out i))
            {
                k = int.Parse(id);
            }

            CASInfo _CASInfo = ServiceHelper.Create <ICASInfoService>().GetCASByPUB_CID(k);
            string  s        = _CASInfo.C2D_Structure;

            ViewBag.CASNo           = id;
            ViewBag.CurrentUserType = 3;
            if (this.CurrentUser != null)
            {
                if (this.CurrentUser.UserType == 2)
                {
                    ViewBag.CurrentUserType = 2;
                }
            }
            string        seostrsql       = string.Format(@"SELECT Meta_Title,Meta_Description,Meta_Keywords FROM dbo.ChemCloud_CasSeo where Pub_CID='{0}'", id);
            List <string> listKeywords    = new List <string>();
            List <string> listDescription = new List <string>();
            List <string> listTitle       = new List <string>();
            DataSet       ds = DbHelperSQL.Query(seostrsql);

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    if (!string.IsNullOrWhiteSpace(Convert.ToString(item["Meta_Keywords"])))
                    {
                        listKeywords.Add(Convert.ToString(item["Meta_Keywords"]));
                    }
                    if (!string.IsNullOrWhiteSpace(Convert.ToString(item["Meta_Description"])))
                    {
                        listDescription.Add(Convert.ToString(item["Meta_Description"]));
                    }
                    if (!string.IsNullOrWhiteSpace(Convert.ToString(item["Meta_Title"])))
                    {
                        listTitle.Add(Convert.ToString(item["Meta_Title"]));
                    }
                }
                if (listKeywords.Count > 0)
                {
                    ((dynamic)base.ViewBag).SEOKeyword = string.Join(",", listKeywords).Length > 72 ? string.Join(",", listKeywords).Substring(0, 72) : string.Join(",", listKeywords);
                }
                if (listDescription.Count > 0)
                {
                    ((dynamic)base.ViewBag).SEODescription = string.Join(",", listDescription).Length > 220 ? string.Join(",", listDescription).Substring(0, 220) : string.Join(",", listDescription);;
                }
                if (listTitle.Count > 0)
                {
                    ((dynamic)base.ViewBag).GetTitle = string.Join(",", listTitle).Length > 60 ? string.Join(",", listTitle).Substring(0, 60) : string.Join(",", listTitle);;
                }
            }
            return(View(_CASInfo));
        }
コード例 #3
0
        /// <summary>
        /// 产品详情页面
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult SearchProductInfo(string id)
        {
            int i;
            int k = 0;

            if (int.TryParse(id, out i))
            {
                k = int.Parse(id);
            }
            CASInfo _CASInfo = ServiceHelper.Create <ICASInfoService>().GetCASByPUB_CID(k);

            //if (RegExHtml(_CASInfo.Record_Description))
            //{
            //    _CASInfo.Record_Description = string.Empty;
            //}
            ViewBag.Title = "ChemCloud产品详细";
            ViewBag.CASNo = id;
            string        seostrsql       = string.Format(@"SELECT Meta_Title,Meta_Description,Meta_Keywords FROM dbo.ChemCloud_CasSeo where 
            Pub_CID={0}", id);
            List <string> listKeywords    = new List <string>();
            List <string> listDescription = new List <string>();
            List <string> listTitle       = new List <string>();
            DataSet       ds = DbHelperSQL.Query(seostrsql);

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    if (!string.IsNullOrWhiteSpace(Convert.ToString(item["Meta_Keywords"])))
                    {
                        listKeywords.Add(Convert.ToString(item["Meta_Keywords"]));
                    }
                    if (!string.IsNullOrWhiteSpace(Convert.ToString(item["Meta_Description"])))
                    {
                        listDescription.Add(Convert.ToString(item["Meta_Description"]));
                    }
                    if (!string.IsNullOrWhiteSpace(Convert.ToString(item["Meta_Title"])))
                    {
                        listTitle.Add(Convert.ToString(item["Meta_Title"]));
                    }
                }
                if (listKeywords.Count > 0)
                {
                    ((dynamic)base.ViewBag).SEOKeyword = string.Join(",", listKeywords).Length > 72 ? string.Join(",", listKeywords).Substring(0, 72) : string.Join(",", listKeywords);
                }
                if (listDescription.Count > 0)
                {
                    ((dynamic)base.ViewBag).SEODescription = string.Join(",", listDescription).Length > 220 ? string.Join(",", listDescription).Substring(0, 220) : string.Join(",", listDescription);;
                }
                if (listTitle.Count > 0)
                {
                    ((dynamic)base.ViewBag).GetTitle = string.Join(",", listTitle).Length > 60 ? string.Join(",", listTitle).Substring(0, 60) : string.Join(",", listTitle);;
                }
            }
            return(View(_CASInfo));
        }
コード例 #4
0
ファイル: CASInfoService.cs プロジェクト: giagiigi/ChemCloud
        public CASInfo GetCASInfoByCid(int cid)
        {
            CASInfo   _CASInfo = new CASInfo();
            string    strsql   = string.Format("SELECT * FROM ChemCloud_CAS with(nolock) where Pub_CID={0}", cid);
            DataTable dt       = DbHelperSQLCAS.QueryDataTable(strsql);

            if (dt != null && dt.Rows.Count > 0)
            {
                _CASInfo = GetEntity <CASInfo>(dt);
            }
            return(_CASInfo);
        }
コード例 #5
0
ファイル: CASInfoService.cs プロジェクト: giagiigi/ChemCloud
        /*根据CASNO查询casinfo*/
        public CASInfo GetCASByNo(string CASNo)
        {
            CASInfo _CASInfo = new CASInfo();

            string    strsql = string.Format("SELECT * FROM ChemCloud_CAS with(nolock) where CAS='{0}'", CASNo);
            DataTable dt     = DbHelperSQLCAS.QueryDataTable(strsql);

            if (dt != null && dt.Rows.Count > 0)
            {
                _CASInfo = GetEntity <CASInfo>(dt);
            }
            return(_CASInfo);
        }
コード例 #6
0
        public JsonResult Auditing(long Id, int status, string CasNo, string comment = "")
        {
            ServiceHelper.Create <IProductService>().UpdateStatus(Id, (ProductInfo.ProductAuditStatus)status, comment);
            ProductInfo     productinfo = ServiceHelper.Create <IProductService>().GetProduct(Id);
            CASInfo         casproduct  = ServiceHelper.Create <ICASInfoService>().GetCASByNo(productinfo.CASNo);
            ICASInfoService casService  = ServiceHelper.Create <ICASInfoService>();

            if (casproduct == null)
            {
                CASInfo casproductinfo = new CASInfo()
                {
                    //CAS_NO = Guid.NewGuid().ToString("D"),
                    CAS                = productinfo.CASNo,
                    CHINESE            = productinfo.ProductName,
                    CHINESE_ALIAS      = productinfo.Alias,
                    Record_Title       = productinfo.EProductName,
                    Record_Description = productinfo.Ealias,
                    Molecular_Formula  = productinfo.MolecularFormula,
                    Molecular_Weight   = productinfo.MolecularWeight,
                    //PSA = productinfo.PASNo,
                    Density       = productinfo.Density,
                    Boiling_Point = productinfo.BoilingPoint,
                    Flash_Point   = productinfo.FlashPoint,
                    //= productinfo.RefractiveIndex,
                    Vapor_Pressure = productinfo.VapourPressure,
                };
                casService.AddCAS(casproductinfo);
            }
            else
            {
                CASInfo casproductinfo = new CASInfo()
                {
                    CAS                = productinfo.CASNo,
                    CHINESE            = productinfo.ProductName,
                    CHINESE_ALIAS      = productinfo.Alias,
                    Record_Title       = productinfo.EProductName,
                    Record_Description = productinfo.Ealias,
                    Molecular_Formula  = productinfo.MolecularFormula,
                    Molecular_Weight   = productinfo.MolecularWeight,
                    //PSA = productinfo.PASNo,
                    Density       = productinfo.Density,
                    Boiling_Point = productinfo.BoilingPoint,
                    Flash_Point   = productinfo.FlashPoint,
                    //= productinfo.RefractiveIndex,
                    Vapor_Pressure = productinfo.VapourPressure,
                };
                casService.UpdateCAS(casproductinfo);
            }
            return(Json(new { Successful = true }));
        }
コード例 #7
0
ファイル: CASController.cs プロジェクト: giagiigi/ChemCloud
 public ActionResult Editing(CASInfo casinfo)
 {
     ServiceHelper.Create <ICASInfoService>().UpdateCAS(casinfo);
     //IOperationLogService operationLogService = ServiceHelper.Create<IOperationLogService>();
     //LogInfo logInfo = new LogInfo()
     //{
     //    Date = DateTime.Now,
     //    Description = string.Concat("修改CAS信息,GUID=", casinfo.Pub_CID),
     //    IPAddress = base.Request.UserHostAddress,
     //    PageUrl = string.Concat("/CAS/Edit/", casinfo.CAS_NO),
     //    UserName = base.CurrentManager.UserName,
     //    ShopId = 0
     //};
     //operationLogService.AddPlatformOperationLog(logInfo);
     return(Json(new { Successful = true }));
 }
コード例 #8
0
ファイル: OrderController.cs プロジェクト: giagiigi/ChemCloud
        public ActionResult Print(long orderId, string shopName)
        {
            OrderItemInfo orderInfo   = ServiceHelper.Create <IOrderService>().GetOrderItemInfo(orderId);
            ProductInfo   productInfo = ServiceHelper.Create <IProductService>().GetProduct(orderInfo.ProductId);
            CASInfo       casInfo     = ServiceHelper.Create <ICASInfoService>().GetCASByNo(productInfo.CASNo);
            ShopInfo      _shopinfo   = ServiceHelper.Create <IShopService>().GetShop(orderInfo.ShopId);

            ViewBag.userName = _shopinfo.ContactsName;
            ViewBag.tel      = _shopinfo.ContactsPhone;
            ViewBag.fax      = _shopinfo.Fax;
            ViewBag.phone    = _shopinfo.ContactsPhone;
            ViewBag.email    = _shopinfo.ContactsEmail;
            ViewBag.address  = _shopinfo.CompanyAddress;
            ViewBag.url      = "https://pubchem.ncbi.nlm.nih.gov/image/imgsrv.fcgi?cid=" + casInfo.Pub_CID + "&t=l";
            ViewBag.shopName = shopName;
            return(View(productInfo));
        }
コード例 #9
0
ファイル: CASInfoService.cs プロジェクト: giagiigi/ChemCloud
        /*根据PUB_CID 检索casifno*/
        public CASInfo GetCASByPUB_CID(int PUB_CID)
        {
            CASInfo _CASInfo = new CASInfo();

            string    strsql = string.Format(@"SELECT 
            PUB_CID,CAS,CHINESE,Record_Title,CHINESE_ALIAS,Record_Description,Molecular_Formula,Molecular_Weight,
            Density,Boiling_Point,Flash_Point,Vapor_Pressure,Exact_Mass,LogP,
            Physical_Description,Melting_Point,Solubility,Storage_Conditions,
            Safety_and_Hazards,HS_CODE,[2D_Structure] as C2D_Structure
            FROM ChemCloud_CAS with(nolock) where Pub_CID='{0}'", PUB_CID);
            DataTable dt     = DbHelperSQLCAS.QueryDataTable(strsql);

            if (dt != null && dt.Rows.Count > 0)
            {
                _CASInfo = GetEntity <CASInfo>(dt);
            }
            return(_CASInfo);
        }
コード例 #10
0
ファイル: CASInfoService.cs プロジェクト: giagiigi/ChemCloud
        public CASInfo GetCASByCASNO(string CAS_NO)
        {
            CASInfo _CASInfo = new CASInfo();

            string    strsql = string.Format("SELECT * FROM ChemCloud_CAS with(nolock) where CAS='{0}'", CAS_NO);
            DataTable dt     = DbHelperSQLCAS.QueryDataTable(strsql);

            if (dt != null && dt.Rows.Count > 0)
            {
                _CASInfo = GetEntity <CASInfo>(dt);
            }

            if (_CASInfo == null)
            {
                CASInfo info = new CASInfo();
                info.Pub_CID = 0;
                return(info);;
            }
            else
            {
                return(_CASInfo);
            }
        }
コード例 #11
0
ファイル: CASController.cs プロジェクト: giagiigi/ChemCloud
        public ActionResult Audit(string CAS_NO)
        {
            CASInfo casno = ServiceHelper.Create <ICASInfoService>().GetCASByCAS_NO(CAS_NO);

            return(View(casno));
        }
コード例 #12
0
ファイル: CASInfoService.cs プロジェクト: giagiigi/ChemCloud
        public void UpdateCAS(CASInfo casinfo)
        {
            CASInfo cas = context.CASInfo.FirstOrDefault((CASInfo m) => m.Pub_CID == casinfo.Pub_CID);

            cas.CHINESE               = casinfo.CHINESE;
            cas.CHINESE_ALIAS         = casinfo.CHINESE_ALIAS;
            cas.HS_CODE               = casinfo.HS_CODE;
            cas.SAFE_DESC             = casinfo.SAFE_DESC;
            cas.Pub_CID               = casinfo.Pub_CID;
            cas.C2D_Structure         = casinfo.C2D_Structure;
            cas.Names_and_Identifiers = casinfo.Names_and_Identifiers;
            cas.Record_Title          = casinfo.Record_Title;
            cas.Record_Description    = casinfo.Record_Description;
            cas.Computed_Descriptors  = casinfo.Computed_Descriptors;
            cas.IUPAC_Name            = casinfo.IUPAC_Name;
            cas.InChI                            = casinfo.InChI;
            cas.InChI_Key                        = casinfo.InChI_Key;
            cas.Canonical_SMILES                 = casinfo.Canonical_SMILES;
            cas.Other_Identifiers                = casinfo.Other_Identifiers;
            cas.Synonyms                         = casinfo.Synonyms;
            cas.MeSH_Synonyms                    = casinfo.MeSH_Synonyms;
            cas.Depositor_Supplied_Synonyms      = casinfo.Depositor_Supplied_Synonyms;
            cas.Chemical_and_Physical_Properties = casinfo.Chemical_and_Physical_Properties;
            cas.Computed_Properties              = casinfo.Computed_Properties;
            cas.Molecular_Weight                 = casinfo.Molecular_Weight;
            cas.Molecular_Formula                = casinfo.Molecular_Formula;
            cas.XLogP3                           = casinfo.XLogP3;
            cas.Exact_Mass                       = casinfo.Exact_Mass;
            cas.Monoisotopic_Mass                = casinfo.Monoisotopic_Mass;
            cas.Topological_Polar_Surface_Area   = casinfo.Topological_Polar_Surface_Area;
            cas.Experimental_Properties          = casinfo.Experimental_Properties;
            cas.Solubility                       = casinfo.Solubility;
            cas.LogP            = casinfo.LogP;
            cas.Related_Records = casinfo.Related_Records;
            cas.Related_Compounds_with_Annotation = casinfo.Related_Compounds_with_Annotation;
            cas.Parent_Compound             = casinfo.Parent_Compound;
            cas.Related_Compounds           = casinfo.Related_Compounds;
            cas.Substances                  = casinfo.Substances;
            cas.Related_Substances          = casinfo.Related_Substances;
            cas.Substances_by_Category      = casinfo.Substances_by_Category;
            cas.Absorption                  = casinfo.Absorption;
            cas.Identification              = casinfo.Identification;
            cas.Safety_and_Hazards          = casinfo.Safety_and_Hazards;
            cas.Accidental_Release_Measures = casinfo.Accidental_Release_Measures;
            cas.Disposal_Methods            = casinfo.Disposal_Methods;
            cas.Regulatory_Information      = casinfo.Regulatory_Information;
            cas.Toxicity = casinfo.Toxicity;
            cas.Toxicological_Information = casinfo.Toxicological_Information;
            cas.Interactions = casinfo.Interactions;
            cas.Antidote_and_Emergency_Treatment    = casinfo.Antidote_and_Emergency_Treatment;
            cas.Human_Toxicity_Excerpts             = casinfo.Human_Toxicity_Excerpts;
            cas.Non_Human_Toxicity_Excerpts         = casinfo.Non_Human_Toxicity_Excerpts;
            cas.Populations_at_Special_Risk         = casinfo.Populations_at_Special_Risk;
            cas.Depositor_Provided_PubMed_Citations = casinfo.Depositor_Provided_PubMed_Citations;
            cas.NLM_Curated_PubMed_Citations        = casinfo.NLM_Curated_PubMed_Citations;
            cas.Classification      = casinfo.Classification;
            cas.C3D_Status          = casinfo.C3D_Status;
            cas.EC_Number           = casinfo.EC_Number;
            cas.Spectral_Properties = casinfo.Spectral_Properties;
            cas.GC_MS                              = casinfo.GC_MS;
            cas.GC_MS_Fields                       = casinfo.GC_MS_Fields;
            cas.GC_MS_Images                       = casinfo.GC_MS_Images;
            cas.MS_MS                              = casinfo.MS_MS;
            cas.MS_MS_Fields                       = casinfo.MS_MS_Fields;
            cas.MS_MS_Images                       = casinfo.MS_MS_Images;
            cas.CAS                                = casinfo.CAS;
            cas.UNII                               = casinfo.UNII;
            cas.Physical_Description               = casinfo.Physical_Description;
            cas.Kovats_Retention_Index             = casinfo.Kovats_Retention_Index;
            cas.Crystal_Structures                 = casinfo.Crystal_Structures;
            cas.CCDC_Number                        = casinfo.CCDC_Number;
            cas.Crystal_Structure_Data             = casinfo.Crystal_Structure_Data;
            cas.Protein_Bound_3_D_Structures       = casinfo.Protein_Bound_3_D_Structures;
            cas.Biologic_Line_Notation             = casinfo.Biologic_Line_Notation;
            cas.Boiling_Point                      = casinfo.Boiling_Point;
            cas.Melting_Point                      = casinfo.Melting_Point;
            cas.pKa                                = casinfo.pKa;
            cas.ICSC_Number                        = casinfo.ICSC_Number;
            cas.RTECS_Number                       = casinfo.RTECS_Number;
            cas.UN_Number                          = casinfo.UN_Number;
            cas.Color                              = casinfo.Color;
            cas.Odor                               = casinfo.Odor;
            cas.Taste                              = casinfo.Taste;
            cas.Flash_Point                        = casinfo.Flash_Point;
            cas.Density                            = casinfo.Density;
            cas.Vapor_Density                      = casinfo.Vapor_Density;
            cas.Vapor_Pressure                     = casinfo.Vapor_Pressure;
            cas.LogS                               = casinfo.LogS;
            cas.Stability                          = casinfo.Stability;
            cas.Auto_Ignition                      = casinfo.Auto_Ignition;
            cas.Decomposition                      = casinfo.Decomposition;
            cas.Viscosity                          = casinfo.Viscosity;
            cas.Corrosivity                        = casinfo.Corrosivity;
            cas.Heat_of_Combustion                 = casinfo.Heat_of_Combustion;
            cas.Heat_of_Vaporization               = casinfo.Heat_of_Vaporization;
            cas.Surface_Tension                    = casinfo.Surface_Tension;
            cas.Chemical_Classes                   = casinfo.Chemical_Classes;
            cas.OSHA_Chemical_Sampling             = casinfo.OSHA_Chemical_Sampling;
            cas.NIOSH_Analytical_Methods           = casinfo.NIOSH_Analytical_Methods;
            cas.Hazards_Identification             = casinfo.Hazards_Identification;
            cas.GHS_Classification                 = casinfo.GHS_Classification;
            cas.Health_Hazard                      = casinfo.Health_Hazard;
            cas.Fire_Hazard                        = casinfo.Fire_Hazard;
            cas.Explosion_Hazard                   = casinfo.Explosion_Hazard;
            cas.Hazards_Summary                    = casinfo.Hazards_Summary;
            cas.Fire_Potential                     = casinfo.Fire_Potential;
            cas.Safety_and_Hazard_Properties       = casinfo.Safety_and_Hazard_Properties;
            cas.LEL                                = casinfo.LEL;
            cas.UEL                                = casinfo.UEL;
            cas.Flammability                       = casinfo.Flammability;
            cas.Critical_Temperature               = casinfo.Critical_Temperature;
            cas.Critical_Pressure                  = casinfo.Critical_Pressure;
            cas.NFPA_Hazard_Classification         = casinfo.NFPA_Hazard_Classification;
            cas.NFPA_Fire_Rating                   = casinfo.NFPA_Fire_Rating;
            cas.NFPA_Health_Rating                 = casinfo.NFPA_Health_Rating;
            cas.Physical_Dangers                   = casinfo.Physical_Dangers;
            cas.Chemical_Dangers                   = casinfo.Chemical_Dangers;
            cas.Explosive_Limits_and_Potential     = casinfo.Explosive_Limits_and_Potential;
            cas.OSHA_Standards                     = casinfo.OSHA_Standards;
            cas.NIOSH_Recommendations              = casinfo.NIOSH_Recommendations;
            cas.Fire_Fighting_Measures             = casinfo.Fire_Fighting_Measures;
            cas.Fire_Fighting                      = casinfo.Fire_Fighting;
            cas.Explosion_Fire_Fighting            = casinfo.Explosion_Fire_Fighting;
            cas.Other_Fire_Fighting_Hazards        = casinfo.Other_Fire_Fighting_Hazards;
            cas.Spillage_Disposal                  = casinfo.Spillage_Disposal;
            cas.Cleanup_Methods                    = casinfo.Cleanup_Methods;
            cas.Other_Preventative_Measures        = casinfo.Other_Preventative_Measures;
            cas.Handling_and_Storage               = casinfo.Handling_and_Storage;
            cas.Nonfire_Spill_Response             = casinfo.Nonfire_Spill_Response;
            cas.Safe_Storage                       = casinfo.Safe_Storage;
            cas.Storage_Conditions                 = casinfo.Storage_Conditions;
            cas.Air_and_Water_Reactions            = casinfo.Air_and_Water_Reactions;
            cas.Reactive_Group                     = casinfo.Reactive_Group;
            cas.Reactivity_Alerts                  = casinfo.Reactivity_Alerts;
            cas.Reactivities_and_Incompatibilities = casinfo.Reactivities_and_Incompatibilities;
            cas.Transport_Information              = casinfo.Transport_Information;
            cas.DOT_Emergency_Guidelines           = casinfo.DOT_Emergency_Guidelines;
            cas.Shipment_Methods_and_Regulations   = casinfo.Shipment_Methods_and_Regulations;
            cas.DOT_ID_and_Guide                   = casinfo.DOT_ID_and_Guide;
            cas.DOT_Label                          = casinfo.DOT_Label;
            cas.Packaging_and_Labelling            = casinfo.Packaging_and_Labelling;
            cas.EC_Classification                  = casinfo.EC_Classification;
            cas.UN_Classification                  = casinfo.UN_Classification;
            cas.Emergency_Response                 = casinfo.Emergency_Response;
            cas.DOT_Emergency_Response_Guide       = casinfo.DOT_Emergency_Response_Guide;
            cas.Federal_Drinking_Water_Standards   = casinfo.Federal_Drinking_Water_Standards;
            cas.CERCLA_Reportable_Quantities       = casinfo.CERCLA_Reportable_Quantities;
            cas.TSCA_Requirements                  = casinfo.TSCA_Requirements;
            cas.RCRA_Requirements                  = casinfo.RCRA_Requirements;
            cas.Other_Safety_Information           = casinfo.Other_Safety_Information;
            cas.Toxic_Combustion_Products          = casinfo.Toxic_Combustion_Products;
            cas.Isomeric_SMILES                    = casinfo.Isomeric_SMILES;
            cas.Status                             = casinfo.Status;
            cas.Federal_Drinking_Water_Guidelines  = casinfo.Federal_Drinking_Water_Guidelines;
            cas.Dissociation_Constants             = casinfo.Dissociation_Constants;
            cas.pH           = casinfo.pH;
            cas.Drug_Warning = casinfo.Drug_Warning;
            cas.Over_the_Counter_Drug_Products = casinfo.Over_the_Counter_Drug_Products;
            cas.OTC_Drug_Ingredient            = casinfo.OTC_Drug_Ingredient;
            cas.OTC_Proprietary_Name           = casinfo.OTC_Proprietary_Name;
            cas.OTC_Applicant              = casinfo.OTC_Applicant;
            cas.FIFRA_Requirements         = casinfo.FIFRA_Requirements;
            cas.Other_Hazardous_Reactions  = casinfo.Other_Hazardous_Reactions;
            cas.Prescription_Drug_Products = casinfo.Prescription_Drug_Products;
            cas.RX_Drug_Ingredient         = casinfo.RX_Drug_Ingredient;
            cas.RX_Proprietary_Name        = casinfo.RX_Proprietary_Name;
            cas.RX_Applicant                            = casinfo.RX_Applicant;
            cas.NFPA_Reactivity_Rating                  = casinfo.NFPA_Reactivity_Rating;
            cas.FDA_Orange_Book_Patents                 = casinfo.FDA_Orange_Book_Patents;
            cas.FDA_Orange_Book_Patent_ID               = casinfo.FDA_Orange_Book_Patent_ID;
            cas.FDA_Orange_Book_Patent_Expiration       = casinfo.FDA_Orange_Book_Patent_Expiration;
            cas.FDA_Orange_Book_Patent_Applicant        = casinfo.FDA_Orange_Book_Patent_Applicant;
            cas.FDA_Orange_Book_Patent_Drug_Application = casinfo.FDA_Orange_Book_Patent_Drug_Application;
            cas.Isolation_Name                          = casinfo.Isolation_Name;
            cas.Isolation_Distance                      = casinfo.Isolation_Distance;
            context.SaveChanges();
        }
コード例 #13
0
ファイル: CASInfoService.cs プロジェクト: giagiigi/ChemCloud
 public void AddCAS(CASInfo casinfo)
 {
     context.CASInfo.Add(casinfo);
     context.SaveChanges();
 }
コード例 #14
0
        public JsonResult UpLoadFile(long shopid, string filename)
        {
            /*供应商产品批量导入*/
            if (!string.IsNullOrWhiteSpace(filename))
            {
                int       ErrorCount = 0, SubErrorCount = 0, RepeatCount = 0, SuccessCount = 0, NullCount = 0;
                DataTable dt = GetExcelData(filename);
                if (dt != null && dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (dt.Rows[i]["Product_Number"] == null || dt.Rows[i]["Chemical_Name"] == null ||
                            dt.Rows[i]["FirstCategory"] == null || dt.Rows[i]["SecondCategory"] == null || dt.Rows[i]["ThirdCategory"] == null)
                        {
                            continue;
                        }
                        if ((ServiceHelper.Create <IProductService>().IsExitsProductCode(shopid, dt.Rows[i]["Product_Number"].ToString())))
                        {
                            RepeatCount = RepeatCount + 1;
                            continue;
                        }
                        try
                        {
                            CategoryInfo categoryInfo = ServiceHelper.Create <ICategoryService>().GetCategoryByName(dt.Rows[i]["ThirdCategory"].ToString().Trim());
                            ProductInfo  Product      = new ProductInfo();
                            /*供应商编号*/
                            Product.ShopId = shopid;
                            /*产品分类*/
                            Product.CategoryId   = (categoryInfo == null ? 0 : categoryInfo.Id);
                            Product.CategoryPath = (categoryInfo == null ? "查找不到路径" : categoryInfo.Path);
                            /*产品货号*/
                            Product.ProductCode = dt.Rows[i]["Product_Number"] == null ? "" : dt.Rows[i]["Product_Number"].ToString();
                            /*产品名*/
                            Product.EProductName = dt.Rows[i]["Chemical_Name"] == null ? "" : dt.Rows[i]["Chemical_Name"].ToString();
                            /*中文名*/
                            Product.ProductName = dt.Rows[i]["Chemical_ChineseName"] == null ? "" : dt.Rows[i]["Chemical_ChineseName"].ToString();
                            /*cas#*/
                            if (dt.Rows[i]["CASNO"] != null && !string.IsNullOrWhiteSpace(dt.Rows[i]["CASNO"].ToString()))
                            {
                                Product.CASNo = dt.Rows[i]["CASNO"].ToString();
                                /*Pub_CID*/
                                CASInfo cas = ServiceHelper.Create <ICASInfoService>().GetCASByCASNO(Product.CASNo);
                                if (cas == null)
                                {
                                    Product.Pub_CID = 0;
                                }
                                else
                                {
                                    Product.Pub_CID = cas.Pub_CID;
                                }
                            }
                            else
                            {
                                Product.CASNo = "";
                            }


                            Product.FreightTemplateId = 138;
                            Product.AddedDate         = DateTime.Now;
                            Product.PackagingLevel    = dt.Rows[i]["Quantity1"] == null ? "" : dt.Rows[i]["Quantity1"].ToString();
                            Product.Purity            = dt.Rows[i]["Purity1"] == null ? "" : dt.Rows[i]["Purity1"].ToString();
                            CASInfo casInfo = ServiceHelper.Create <ICASInfoService>().GetCASByNo(dt.Rows[i]["CASNO"].ToString());
                            if (casInfo != null)
                            {
                                Product.MolecularFormula = casInfo.Molecular_Formula;
                                Product.MolecularWeight  = casInfo.Molecular_Weight;
                                Product.LogP             = casInfo.LogP;
                                Product.FusingPoint      = casInfo.UN_Number;
                                Product.BoilingPoint     = casInfo.RTECS_Number;
                                Product.FlashPoint       = casInfo.LogS;
                                Product.VapourPressure   = casInfo.Vapor_Pressure;
                                Product.DangerousMark    = casInfo.Density;
                            }
                            if (!string.IsNullOrWhiteSpace(dt.Rows[i]["Price1"].ToString()))
                            {
                                Product.MinSalePrice = Convert.ToDecimal(dt.Rows[i]["Price1"].ToString());
                            }
                            else
                            {
                                Product.MinSalePrice = 0;
                            }
                            Product.Plat_Code = DateTime.Now.ToString("yyyyMMddHHmmssffff").ToString();
                            ServiceHelper.Create <IProductService>().AddProduct(Product);
                            ProductInfo productInfo = ServiceHelper.Create <IProductService>().GetProductByCondition(shopid, dt.Rows[i]["Product_Number"].ToString());
                            if (productInfo == null)
                            {
                                NullCount = NullCount + 1;
                            }
                            else
                            {
                                try
                                {
                                    if (!string.IsNullOrWhiteSpace(dt.Rows[i]["Grade1"].ToString()))
                                    {
                                        ProductSpec productSpec1 = new ProductSpec();
                                        productSpec1.ProductId = productInfo.Id;
                                        productSpec1.Packaging = dt.Rows[i]["Quantity1"].ToString();
                                        productSpec1.Purity    = dt.Rows[i]["Purity1"].ToString();
                                        if (!string.IsNullOrWhiteSpace(dt.Rows[i]["Price1"].ToString()))
                                        {
                                            productSpec1.Price = Convert.ToDecimal(dt.Rows[i]["Price1"].ToString());
                                        }
                                        else
                                        {
                                            productSpec1.Price = 0;
                                        }
                                        productSpec1.SpecLevel = dt.Rows[i]["Grade1"].ToString();
                                        if (dt.Rows[i]["Currency1"].ToString() == "CNY")
                                        {
                                            productSpec1.CoinType = 1;
                                        }
                                        if (dt.Rows[i]["Currency1"].ToString() == "USD")
                                        {
                                            productSpec1.CoinType = 2;
                                        }
                                        if (string.IsNullOrWhiteSpace(dt.Rows[i]["Currency1"].ToString()))
                                        {
                                            int LanguageId = int.Parse(System.Configuration.ConfigurationManager.AppSettings["Language"].ToString());
                                            if (LanguageId == 1)
                                            {
                                                productSpec1.CoinType = 1;
                                            }
                                            if (LanguageId == 2)
                                            {
                                                productSpec1.CoinType = 2;
                                            }
                                        }
                                        ServiceHelper.Create <IProductService>().AddProductSpecs(productSpec1);
                                    }

                                    if (!string.IsNullOrWhiteSpace(dt.Rows[i]["Grade2"].ToString()))
                                    {
                                        ProductSpec productSpec2 = new ProductSpec();
                                        productSpec2.ProductId = productInfo.Id;
                                        productSpec2.Packaging = dt.Rows[i]["Quantity2"].ToString();
                                        productSpec2.Purity    = dt.Rows[i]["Purity2"].ToString();
                                        if (!string.IsNullOrWhiteSpace(dt.Rows[i]["Price2"].ToString()))
                                        {
                                            productSpec2.Price = Convert.ToDecimal(dt.Rows[i]["Price2"].ToString());
                                        }
                                        else
                                        {
                                            productSpec2.Price = 0;
                                        }
                                        productSpec2.SpecLevel = dt.Rows[i]["Grade2"].ToString();
                                        if (dt.Rows[i]["Currency2"].ToString() == "CNY")
                                        {
                                            productSpec2.CoinType = 1;
                                        }
                                        if (dt.Rows[i]["Currency2"].ToString() == "USD")
                                        {
                                            productSpec2.CoinType = 2;
                                        }
                                        if (string.IsNullOrWhiteSpace(dt.Rows[i]["Currency2"].ToString()))
                                        {
                                            int LanguageId = int.Parse(System.Configuration.ConfigurationManager.AppSettings["Language"].ToString());
                                            if (LanguageId == 1)
                                            {
                                                productSpec2.CoinType = 1;
                                            }
                                            if (LanguageId == 2)
                                            {
                                                productSpec2.CoinType = 2;
                                            }
                                        }
                                        ServiceHelper.Create <IProductService>().AddProductSpecs(productSpec2);
                                    }

                                    if (!string.IsNullOrWhiteSpace(dt.Rows[i]["Grade3"].ToString()))
                                    {
                                        ProductSpec productSpec3 = new ProductSpec();
                                        productSpec3.ProductId = productInfo.Id;
                                        productSpec3.Packaging = dt.Rows[i]["Quantity3"].ToString();
                                        productSpec3.Purity    = dt.Rows[i]["Purity3"].ToString();
                                        if (!string.IsNullOrWhiteSpace(dt.Rows[i]["Price3"].ToString()))
                                        {
                                            productSpec3.Price = Convert.ToDecimal(dt.Rows[i]["Price3"].ToString());
                                        }
                                        else
                                        {
                                            productSpec3.Price = 0;
                                        }
                                        productSpec3.SpecLevel = dt.Rows[i]["Grade3"].ToString();
                                        if (dt.Rows[i]["Currency3"].ToString() == "CNY")
                                        {
                                            productSpec3.CoinType = 1;
                                        }
                                        if (dt.Rows[i]["Currency3"].ToString() == "USD")
                                        {
                                            productSpec3.CoinType = 2;
                                        }
                                        if (string.IsNullOrWhiteSpace(dt.Rows[i]["Currency3"].ToString()))
                                        {
                                            int LanguageId = int.Parse(System.Configuration.ConfigurationManager.AppSettings["Language"].ToString());
                                            if (LanguageId == 1)
                                            {
                                                productSpec3.CoinType = 1;
                                            }
                                            if (LanguageId == 2)
                                            {
                                                productSpec3.CoinType = 2;
                                            }
                                        }
                                        ServiceHelper.Create <IProductService>().AddProductSpecs(productSpec3);
                                    }
                                }
                                catch
                                {
                                    SubErrorCount = SubErrorCount + 1;
                                }
                            }
                        }
                        catch
                        {
                            ErrorCount = ErrorCount + 1;
                        }
                        if (ErrorCount == 0 && SubErrorCount == 0 && NullCount == 0 && RepeatCount == 0)
                        {
                            SuccessCount = SuccessCount + 1;
                        }
                    }
                }
                if (ErrorCount > 0 && SubErrorCount > 0)
                {
                    return(Json(new { success = true, message = 2, ErrorCount = ErrorCount, SubErrorCount = SubErrorCount, SuccessCount = SuccessCount }));//5商品已经导入," + "有" + ErrorCount + "条数据有误," + "有" + SubErrorCount + "条等级相关数据有错误。
                }
                else if (ErrorCount > 0)
                {
                    return(Json(new { success = true, message = 3, ErrorCount = ErrorCount, SuccessCount = SuccessCount }));//"4商品已经导入," + "有" + ErrorCount + "条数据有误。"
                }
                else if (SubErrorCount > 0)
                {
                    return(Json(new { success = true, message = 4, SubErrorCount = SubErrorCount, SuccessCount = SuccessCount }));//"3商品已经导入," + "有" + SubErrorCount + "条等级相关数据有错误。"
                }
                else if (RepeatCount > 0)
                {
                    return(Json(new { success = true, message = 1, RepeatCount = RepeatCount, SuccessCount = SuccessCount }));
                }
                else if (NullCount > 0)
                {
                    return(Json(new { success = true, message = 7, NullCount = NullCount, SuccessCount = SuccessCount }));
                }
                else
                {
                    return(Json(new { success = true, message = 5, SuccessCount = SuccessCount }));//"1所有数据成功导入商品!"
                }
            }
            else
            {
                return(Json(new { success = false, message = 6 }));//"2没有找到文件!"
            }
        }