示例#1
0
        public static ICommandCollection GetCommandCollection()
        {
            //maak hier de DAL aan en geef mee
            IDALClass dal = new DALClass();

            return(new CommandCollection(dal));
        }
示例#2
0
        private DALClass getNewDAL(ProjectVariable nameSpace)
        {
            ConnectionString readConn = new ConnectionString(1, "Reader", "db_reader");
            ConnectionString editConn = new ConnectionString(2, "Editor", "db_editor");
            DALClass         dal      = new DALClass();

            dal.NameSpaceName            = nameSpace;
            dal.Name                     = nameSpace + "DAL";
            dal.ReadOnlyConnectionString = readConn;
            dal.EditOnlyConnectionstring = editConn;

            return(dal);
        }
示例#3
0
    public static string getDALText(string readOnlyString, string editOnlySTring, DALClass pVariable, StringBuilder strFunctions, cg.Language lang)
    {
        StringBuilder strB = new StringBuilder();

        strB.Append(cg.getPageImports(lang, true, true));
        if (lang == CodeGeneration.Language.VisualBasic)
        {
            strB.AppendLine();
            strB.AppendLine("Namespace " + pVariable.NameSpaceName.Name);
            strB.AppendLine(Strings.Space((int)tab.X) + "Public Class " + pVariable.Name);
            strB.AppendLine(Strings.Space((int)tab.XX) + "Inherits IRICommonObjects.DALBase");
            strB.AppendLine(Strings.Space((int)tab.X) + "Private Shared " + readOnlyString + " As String = ConfigurationManager.AppSettings(\"" + readOnlyString + "\")");
            strB.AppendLine(Strings.Space((int)tab.X) + "Private Shared " + editOnlySTring + " As String = ConfigurationManager.AppSettings(\"" + editOnlySTring + "\")");
            strB.AppendLine();
            strB.AppendLine(Strings.Space((int)tab.X) + "Private Sub New()");
            strB.AppendLine();
            strB.AppendLine(Strings.Space((int)tab.X) + "End Sub");
            strB.AppendLine(getEnums(lang));
            strB.AppendLine(getDBConnectFunctionsInVB());
            strB.AppendLine(strFunctions.ToString());
            strB.AppendLine(Strings.Space((int)tab.X) + "End Class");
            strB.AppendLine("End NameSpace");
        }
        else
        {
            strB.AppendLine();
            strB.AppendLine("namespace " + pVariable.NameSpaceName.Name);
            strB.AppendLine("{");
            strB.AppendLine(Strings.Space((int)tab.X) + "public class " + pVariable.Name + " : IRICommonObjects.DALBase");
            strB.AppendLine(Strings.Space((int)tab.X) + "{");
            strB.AppendLine(Strings.Space((int)tab.XX) + "private static string " + readOnlyString + " = ConfigurationManager.AppSettings[\"" + readOnlyString + "\"];");
            strB.AppendLine(Strings.Space((int)tab.XX) + "private static string " + editOnlySTring + " = ConfigurationManager.AppSettings[\"" + editOnlySTring + "\"];");
            strB.AppendLine(Strings.Space((int)tab.XX) + "private " + pVariable.Name + "()");
            strB.AppendLine(Strings.Space((int)tab.XX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
            strB.AppendLine(getEnums(lang));
            strB.AppendLine(getDBConnectFunctionsInCSharp());
            strB.AppendLine(strFunctions.ToString());
            strB.AppendLine(Strings.Space((int)tab.X) + "}");
            strB.AppendLine("}");
        }
        return(strB.ToString());
    }
示例#4
0
        /// <summary>
        /// Method to get all employment status list.
        /// </summary>
        /// <returns>List of all employment status</returns>
        public static List <EmploymentStatus> GetAllEmploymentStatus()
        {
            List <EmploymentStatus> employmentStatusList = new List <EmploymentStatus>();

            DataTable dt = new DataTable();

            dt = DALClass.GetAllEmploymentStatus();

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    employmentStatusList.Add(new EmploymentStatus
                    {
                        EmploymentStatusID   = Convert.ToInt32(row[0]),
                        EmploymentStatusName = row[1].ToString()
                    });
                }
            }

            return(employmentStatusList);
        }
示例#5
0
        /// <summary>
        /// Method to get all designations.
        /// </summary>
        /// <returns>List of designation</returns>
        public static List <Designation> GetAllDesignation()
        {
            List <Designation> designationList = new List <Designation>();

            DataTable dt = new DataTable();

            dt = DALClass.GetAllDesignation();

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    designationList.Add(new Designation
                    {
                        DesignationID   = Convert.ToInt32(row[0]),
                        DesignationName = row[1].ToString()
                    });
                }
            }

            return(designationList);
        }
示例#6
0
 public BLLClass()
 {
     //DC = new DALClass("208.118.63.26", "a41be6_andro01", "wording", "root1234");
     DC = new DALClass("localhost", "andromeda", "root", "root");
     //DC = new DALClass("MYSQL5006.site4now.net", "db_a41be6_andro01", "a41be6_andro01", "root1234");
 }
示例#7
0
    public bool UpdateProductData(int ProdId, int Amount)
    {
        DALClass objDALProd = new DALClass();

        return(objDALProd.UpdateProductData(ProdId, Amount));
    }
 public BLClass()
 {
     _dal = new DALClass();
 }
示例#9
0
        static void Main(string[] args)
        {
            DALClass music = new DALClass();

            music.GetPlates();
        }
示例#10
0
文件: Program.cs 项目: ssashkaa01/ef
 public Server()
 {
     _dal = new DALClass();
 }
示例#11
0
        public IActionResult Upload(IFormFile fupFile, string name, string uniquekey)
        {
            // Import Stats
            DateTime startImport = DateTime.Now;
            long     lineCreated = 0;
            // end stats


            Project thisProject = new Project()
            {
                Key = uniquekey
            };
            List <ProjectFile> thisFiles = new List <ProjectFile>();

            string uploadFolder  = Path.GetFullPath("Uploads") + "\\" + uniquekey + "\\";
            string filePath      = uploadFolder + fupFile.FileName;
            string nameSpaceName = getCleanNameSpace(fupFile.FileName);

            // create directory for upload
            Directory.CreateDirectory(uploadFolder);
            //
            string saveFolderPath = Path.GetFullPath("Projects") + @"\" + thisProject.Key;

            // copy uploaded file to upload directory.
            using (FileStream fs = new FileStream(filePath, FileMode.Create)) {
                fupFile.CopyTo(fs);
                fs.Close();
            }
            List <string>       messages        = new List <string>();
            List <ProjectClass> classes         = SQLScriptConversion.generateObjects(filePath, ref messages);
            ProjectVariable     nameSpaceObject = new ProjectVariable(1, nameSpaceName);

            StaticVariables.Instance.NameSpaceNames.Append(nameSpaceObject);
            DALClass dalClassObject = getNewDAL(nameSpaceObject);

            if (!Directory.Exists(saveFolderPath))
            {
                // no directory; create it
                Directory.CreateDirectory(saveFolderPath);
            }
            StringBuilder sprocScripts = new StringBuilder();
            StringBuilder dalFunctions = new StringBuilder();

            foreach (ProjectClass pClass in classes)
            {
                String fileName = pClass.Name.Capitalized() + ".cs";
                pClass.DALClassVariable  = dalClassObject;
                pClass.NameSpaceVariable = nameSpaceObject;
                string classContent = ClassGenerator.getEntireClass(pClass, name, CodeGeneration.Language.CSharp, CodeGeneration.Format.ASPX, ref messages);
                // save file to project folder.
                using (StreamWriter sw = new StreamWriter(saveFolderPath + @"\" + fileName, false)) {
                    lineCreated += classContent.Count('\n');
                    sw.Write(classContent);
                }

                thisFiles.Add(new ProjectFile()
                {
                    Name    = fileName, PhysicalPath = saveFolderPath + @"\",
                    Project = thisProject
                });

                sprocScripts.Append(StoredProcsGenerator.getSprocText(pClass, name, ref messages));
                dalFunctions.Append(DALGenerator.getDALFunctions(pClass, CodeGeneration.Language.CSharp));
            }

            // Save SProcs file
            string sprocFileName = "StoredProcedures.sql";

            using (StreamWriter sw = new StreamWriter(saveFolderPath + @"\" + sprocFileName, false)) {
                string sprocString = sprocScripts.ToString();
                lineCreated += sprocString.Count('\n');
                sw.Write(sprocString);
                thisFiles.Add(new ProjectFile()
                {
                    Name    = sprocFileName, PhysicalPath = saveFolderPath + @"\",
                    Project = thisProject
                });
            }

            // Save DAL file
            string dalContent  = DALGenerator.getDALText("ReadOnlyConnectionString", "EditOnlyConnectionString", dalClassObject, dalFunctions, CodeGeneration.Language.CSharp);
            string dalFileName = dalClassObject.Name + ".cs";

            using (StreamWriter sw = new StreamWriter(saveFolderPath + @"\" + dalFileName, false)) {
                lineCreated += dalContent.Count('\n');
                sw.Write(dalContent);
                thisFiles.Add(new ProjectFile()
                {
                    Name    = dalFileName, PhysicalPath = saveFolderPath + @"\",
                    Project = thisProject
                });
            }

            TimeSpan timeTaken = DateTime.Now - startImport;

            thisProject.Files = thisFiles;
            thisProject.ConversionMessages = messages;
            thisProject.LinesGenerated     = lineCreated;
            thisProject.TimeTaken          = timeTaken;
            string projName = nameSpaceName + ".proj";

            using (StreamWriter sw = new StreamWriter(saveFolderPath + @"\" + projName, false)) {
                string projJSON = System.Text.Json.JsonSerializer.Serialize(thisProject);
                sw.Write(projJSON);
            }
            //return View(thisProject);

            //https://stackoverflow.com/questions/13510204/json-net-self-referencing-loop-detected
            TempData["CurrentProject"] = Newtonsoft.Json.JsonConvert.SerializeObject(thisProject,
                                                                                     new Newtonsoft.Json.JsonSerializerSettings()
            {
                ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
            });
            return(RedirectToAction("List", new { uniquekey = thisProject.Key }));
        }
示例#12
0
        public static ICommand GetCommand()
        {
            IDALClass dal = new DALClass();

            return(new Command(dal));
        }
示例#13
0
文件: Program.cs 项目: ssashkaa01/ef
 public AsyncServer(string strAddr, int port)
 {
     _dal = new DALClass();
     endP = new IPEndPoint(IPAddress.Parse(strAddr), port);
 }
示例#14
0
        // public static List<DTOClass> listDto;

        public DtoList GetDtoData()
        {
            try
            {
                DALClass Obj     = new DALClass();
                DtoList  listDto = new DtoList();
                listDto.Emplist = new List <DTOClass>();
                EmpEntityList emp = Obj.GetAllDetails();
                foreach (var data in emp.Emplist)
                {
                    DTOClass dt = new DTOClass
                    {
                        Id           = data.Id,
                        Name         = data.Name,
                        DesgnationId = data.DesgnationId,
                        Designation  = data.Designation,
                        Gender       = data.Gender,
                        DepartmentId = data.DepartmentId,
                        Department   = data.Department,
                        Experience   = data.Experience,
                        Skills       = data.Skills,
                        EmailId      = data.EmailId,
                        ContactNo    = data.ContactNo,
                        SupervisorId = data.SupervisorId,
                        Supervisor   = data.Supervisor,
                        DateOfBirth  = data.DateOfBirth,
                        Address      = data.Address,
                        InsertedBy   = data.InsertedBy,
                        InsertedOn   = data.InsertedOn,
                        UpdatedBy    = data.UpdatedBy,
                        UpdatedOn    = data.UpdatedOn
                    };
                    listDto.Emplist.Add(dt);
                }

                listDto.DesnList = new List <LookupDTO>();
                foreach (var data in emp.DesnList)
                {
                    LookupDTO desgObj = new LookupDTO()
                    {
                        Id   = data.Id,
                        Name = data.Name
                    };
                    listDto.DesnList.Add(desgObj);
                }

                listDto.DeptList = new List <LookupDTO>();
                foreach (var data in emp.DeptList)
                {
                    LookupDTO deptObj = new LookupDTO()
                    {
                        Id   = data.Id,
                        Name = data.Name
                    };

                    listDto.DeptList.Add(deptObj);
                }
                listDto.SupervisorList = new List <DTOClass>();
                int c = emp.SupervisorList.Count();

                foreach (var data in emp.SupervisorList)
                {
                    DTOClass superObj = new DTOClass()
                    {
                        Id         = data.Id,
                        Supervisor = data.Supervisor
                    };
                    listDto.SupervisorList.Add(superObj);
                }
                return(listDto);
            }
            catch
            {
                return(null);
            }
        }