Exemple #1
0
        public static HeaderItemCollection HideColumn <T>(DNHUsers objUser, string Page)
        {
            HeaderItemCollection ColumnName = new HeaderItemCollection();

            if (objUser == null)
            {
                return(ColumnName);
            }
            //check the UserFile has exist or not
            string FileName = IOHelper.GetDirectory(myConfig.UserDataFolder + objUser.CompanyID + "\\Header\\" + objUser.UserName + "\\" + Page) + "\\Hideheader.bin";

            if (IOHelper.hasFile(FileName))
            {
                //get form the file
                ColumnName = IOHelper.ReadFromBinaryFile <HeaderItemCollection>(FileName);
            }
            else
            {
                //var nopConfig =

                ColumnName = CommonHelper.JsonHideHeaderList <T>(objUser);
                IOHelper.WriteToBinaryFile <HeaderItemCollection>(FileName, ColumnName);
            }



            return(ColumnName);
        }
Exemple #2
0
        public static DNHSiteMapCollection ReadWriteSiteMap(DNHUsers objUser)
        {
            DNHSiteMapCollection objSMaps = new DNHSiteMapCollection();

            if (objUser != null)
            {
                //DNHSiteMapManager.GetAllByUser(objUser.DomainID, objUser.CompanyID, null);

                //save file

                string FileName = IOHelper.GetDirectory(string.Format(myConfig.UserSiteMapFolder, objUser.CompanyID) + objUser.UserName) + "\\sitemap.bin";
                if (IOHelper.HasFile(FileName))
                {
                    //get form the file
                    objSMaps = IOHelper.ReadFromBinaryFile <DNHSiteMapCollection>(FileName);
                }
                else
                {
                    objSMaps = DNHSiteMapManager.GetAllByUser(objUser.UserName, objUser.CompanyID, null);
                    //var nopConfig =
                    if (objSMaps.Count > 0)
                    {
                        IOHelper.WriteToBinaryFile <IList <DNHSiteMap> >(FileName, objSMaps);
                    }
                }
                objUser.UserSiteMaps = objSMaps;
                // Contract objContract = ContractManager.GetById(objEmp.EmployeeCode);
                //add UserSession
                HttpContext.Current.Session[SystemConfig.loginKey] = objUser;
            }
            return(objSMaps);
        }
Exemple #3
0
 public static string L(string Resource)
 {
     Biz.Core.DNHUsers objUser = Biz.Core.Security.CustomerAuthorize.CurrentUser;
     if (objUser != null)
     {
         return(Biz.Core.Services.DNHLocaleStringResourceManager.LResource(Resource, objUser.CompanyID, objUser.UserLanguageID).ResourceValue);
     }
     return(Resource);
 }
Exemple #4
0
        public static System.Data.DataTable GetImportErrorFile <T>(DNHUsers objUser, string Screen)
        {
            DataTable dt       = new DataTable();
            string    FileName = UserFileImportFolder(objUser.CompanyID, objUser.UserName, Screen) + "Exc.bin";

            if (IOHelper.HasFile(FileName))
            {
                //get form the file
                dt = IOHelper.ReadFromBinaryFile <IEnumerable <T> >(FileName).ToDataTable <T>();
            }
            return(dt);
        }
Exemple #5
0
        public static HeaderItemCollection JsonHideHeaderList <T>(DNHUsers ObjUser)
        {
            HeaderItemCollection myCols = new HeaderItemCollection();
            Type t = typeof(T);

            PropertyInfo[]  pia = t.GetProperties();
            PropertyInfo    propertyInfo;
            ColumnAttribute myCustom;
            HeaderItem      item;
            bool            isHide = false;

            for (int i = 0; i < pia.Length; i++)
            {
                item         = new HeaderItem();
                propertyInfo = pia[i];
                if (propertyInfo == null)
                {
                    continue;
                }
                item.name  = propertyInfo.Name;
                item.value = L(propertyInfo.Name);
                item.type  = JsonTypes(propertyInfo);
                isHide     = false;
                int CustomLength = propertyInfo.CustomAttributes.Count <CustomAttributeData>();

                if (CustomLength > 0)
                {
                    var attributes = propertyInfo.GetCustomAttributes(false);
                    foreach (var attribute in attributes)
                    {
                        //check if the object has attribute and set the data
                        if (attribute.GetType() == typeof(ColumnAttribute))
                        {
                            myCustom = (ColumnAttribute)attribute;
                            isHide   = myCustom.Hide;
                            if (!myCustom.Hide)
                            {
                                item.alink = myCustom.ActionLink;
                                item.type  = myCustom.DataType.ToLower();
                                //   coumnvalue = "{\"name\":\"" + propertyInfo.Name + "\",\"type\":\"" + myCustom.DataType + "\",\"value\":\"" + L(propertyInfo.Name) + "\",\"alink\":\"" + myCustom.ActionLink + "\"}";
                            }
                        }
                    }
                }


                if (i >= pia.Length - 5 || isHide)
                {
                    myCols.Add(item);
                }
            }
            return(myCols);
        }
Exemple #6
0
        public static void SaveImportErrorFile <T>(DNHUsers objUser, string Screen, IEnumerable <T> objSMaps)
        {
            string FileName = UserFileImportFolder(objUser.CompanyID, objUser.UserName, Screen) + "Exc.bin";

            IOHelper.WriteToBinaryFile <IEnumerable <T> >(FileName, objSMaps);
        }
Exemple #7
0
        public static void SaveImportFile <T>(DNHUsers objUser, string Screen, string ExFile, IEnumerable <T> objSMaps)
        {
            string FileName = UserFileImportFolder(objUser.CompanyID, objUser.UserName, Screen) + ExFile + "_" + DateTime.Today.ToFileTimeUtc() + ".bin";

            IOHelper.WriteToBinaryFile <IEnumerable <T> >(FileName, objSMaps);
        }