예제 #1
0
    private static string getPropertyStringForDerivedObject(ProjectClass pClass, ClassVariable classVar, string propertyAttribute,
                                                            string nameWithoutUnderscore, string nameWithUnderscore, DataType mDataType, string namSpace, string DAL, language lang,
                                                            CodeGeneration.Format codeFormat)
    {
        StringBuilder strB             = new StringBuilder();
        var           nameOfIDVariable = nameWithoutUnderscore + "ID";

        if (lang == language.VisualBasic)
        {
            strB.Append(cg.GetByLanguage(lang,
                                         getPropertyStringForDerivedObjectInVB(nameOfIDVariable, classVar, propertyAttribute,
                                                                               nameWithoutUnderscore, nameWithUnderscore, mDataType),
                                         getPropertyStringForDerivedObjectInCSharp(nameOfIDVariable, classVar, propertyAttribute,
                                                                                   nameWithoutUnderscore, nameWithUnderscore, mDataType)));
        }
        int ID = 0;

        if (pClass.ClassVariables.Count > 0)
        {
            ID = pClass.ClassVariables[pClass.ClassVariables.Count - 1].ID + 1;
        }

        // TODO: Fix this
        if (!classVar.IsList)
        {
            strB.Append(getPropertyText(pClass, new ClassVariable(pClass, nameOfIDVariable,
                                                                  StaticVariables.Instance.GetDataType("Integer"), false, false, false, true, classVar.IsPropertyInherited,
                                                                  classVar.DisplayOnEditPage, classVar.DisplayOnViewPage, ID, true, false, "Integer", -1, "NA"), namSpace, lang, codeFormat, DAL));
        }
        return(strB.ToString());
    }
예제 #2
0
 //PPT文件展示是保存有多种项目的目录,一个项目对应一个目录,该目录的名称中的第一个图片为展示图片
 public void SearchPPTDirectory( )                                         //加载PPT文件夹
 {
     if (dirLists.Count != 0 && SaveData.instance.ProjectLists.Count == 0) //存在,则分别读取路径里面的图片
     {
         foreach (string s in dirLists)
         {
             if (s.Contains("项目展示"))
             {
                 DirectoryInfo folder = new DirectoryInfo(s);
                 foreach (DirectoryInfo directory in folder.GetDirectories())
                 {
                     pptLists.Add(directory.FullName);
                     ProjectClass newPrj = new ProjectClass();
                     newPrj.projectName = directory.Name;
                     foreach (FileInfo file in directory.GetFiles())
                     {
                         Sprite newSprite = Sprite.Create(new Texture2D(1920, 1080), new Rect(0, 0, 1920, 1080), new Vector2(0.5f, 0.5f));
                         newSprite.name = file.Name;
                         LoadImageByPath(file.FullName, out newSprite);
                         newPrj.spriteLists.Add(newSprite);
                     }
                     SaveData.instance.ProjectLists.Add(newPrj);
                 }
             }
         }
     }
     fileReadState = true;
 }
예제 #3
0
        private void mockTreeView()
        {
            for (int i = 0; i < 1; i++)
            {
                Project project = new Project();
                project.NameSpace = "Prodesp.Gsnet.Framework.Extensionxx " + i;

                ProjectClass projectClass = new ProjectClass();
                projectClass.Name = "ETL " + i;

                ProjectAttribute attribute = new ProjectAttribute {
                    Name = "Version " + i
                };
                projectClass.Attributes.Add(attribute);

                attribute = new ProjectAttribute {
                    Name = "Project " + i
                };
                projectClass.Attributes.Add(attribute);

                attribute = new ProjectAttribute {
                    Name = "Catalog " + i
                };
                projectClass.Attributes.Add(attribute);

                project.ProjectClasses.Add(projectClass);
                _Projects.Add(project);
            }
        }
예제 #4
0
    private string getUpdateObject(ProjectClass pClass, language lang)
    {
        StringBuilder strB = new StringBuilder();

        if (lang == language.VisualBasic)
        {
            strB.AppendLine(Strings.Space((int)tab.X) + "Private Function update" + pClass.Name.Capitalized() + "(ByVal my" + pClass.Name.Capitalized() + " As " + pClass.NameSpaceVariable.NameBasedOnID + "." + pClass.Name.Capitalized() + ") As Boolean");
            strB.AppendLine(Strings.Space((int)tab.XX) + "If my" + pClass.Name.Capitalized() + ".dbUpdate() > 0 Then");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "SessionVariables.addSuccess(StringToolkit.getDatabaseSuccessString(AliasGroup." + pClass.Name.Capitalized() + ", AliasGroup.Edit))");
            strB.AppendLine(Strings.Space((int)tab.XX) + "Else");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "SessionVariables.addError(StringToolkit.getDatabaseErrorString(AliasGroup." + pClass.Name.Capitalized() + ", AliasGroup.Edit))");
            strB.AppendLine(Strings.Space((int)tab.XX) + "End If");
            strB.AppendLine(Strings.Space((int)tab.X) + "End Function");
        }
        else
        {
            strB.AppendLine(Strings.Space((int)tab.X) + "private bool update" + pClass.Name.Capitalized() + "(" + pClass.NameSpaceVariable.NameBasedOnID + "." + pClass.Name.Capitalized() + " my" + pClass.Name.Capitalized() + ")");
            strB.AppendLine(Strings.Space((int)tab.X) + "{");
            strB.AppendLine(Strings.Space((int)tab.XX) + "if (my" + pClass.Name.Capitalized() + ".dbUpdate() > 0)");
            strB.AppendLine(Strings.Space((int)tab.XX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "SessionVariables.addSuccess(StringToolkit.getDatabaseSuccessString(AliasGroup." + pClass.Name.Capitalized() + ", AliasGroup.Edit));");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XX) + "else");
            strB.AppendLine(Strings.Space((int)tab.XX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "SessionVariables.addError(StringToolkit.getDatabaseErrorString(AliasGroup." + pClass.Name.Capitalized() + ", AliasGroup.Edit));");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
            strB.AppendLine(Strings.Space((int)tab.X) + "}");
        }
        return(strB.ToString());
    }
예제 #5
0
        /// <summary>
        /// Конструктор класса сессии пользователя
        /// </summary>
        /// <param name="AWebSocketSessionIDSessionID">Идентификатор сессии WebSocket-сервера</param>
        /// <param name="AHandler">Обработчик WebSocket-соединения</param>
        /// <param name="AProject">Вспомогательный класс проекта</param>
        public UserSessionClass(string AWebSocketSessionIDSessionID, WebSocketHandlerClass AHandler, ref ProjectClass AProject)
        {
            WebSocketSessionID = AWebSocketSessionIDSessionID;
            Handler            = AHandler;
            Project            = AProject;
            IsActive           = true;

            Login = new Handlers.LoginClass();
            Login.SetUserSession(this);

            Logout = new Handlers.LogoutClass();
            Logout.SetUserSession(this);

            UserInformation = new Handlers.UserInformationClass();
            UserInformation.SetUserSession(this);

            Users        = new Handlers.HandlerUsersClass(this);
            Jobs         = new Handlers.HandlerJobsClass(this);
            Roles        = new Handlers.HandlerRolesClass(this);
            UsersRoles   = new Handlers.HandlerUsersRolesClass(this);
            Objects      = new Handlers.HandlerObjectsClass(this);
            RolesObjects = new Handlers.HandlerRolesObjectsClass(this);

            InputQueueProcessing  = new Thread(InputQueueProcessingThread);
            OutputQueueProcessing = new Thread(OutputQueueProcessingThread);
            InputQueueProcessing.Start();
            OutputQueueProcessing.Start();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         String qry;
         if (!IsPostBack)
         {
             if (Session["uid"].ToString() == "")
             {
                 Response.Redirect("Index.aspx");
             }
             else
             {
                 qry = "select * from UserDB where User_Id='" + Session["uid"].ToString() + "'";
                 SqlDataReader dr = ProjectClass.getRecords(qry);
                 if (dr.Read())
                 {
                     string s = dr.GetValue(2).ToString() + " " + dr.GetValue(3).ToString();
                     lblName.Text = "Hello";
                     string a = dr.GetValue(5).ToString();
                     lblEmail.Text          = dr.GetValue(5).ToString();
                     lblAddress.Text        = dr.GetValue(7).ToString();
                     lblResidentalArea.Text = dr.GetValue(8).ToString();
                     lblContact.Text        = dr.GetValue(10).ToString();
                 }
                 dr.Close();
             }
         }
     }
     catch { }
     finally { }
 }
예제 #7
0
 private static void SetClass(IImmutableSet <string> ids, ProjectClass @class)
 {
     foreach (var id in ids)
     {
         _classes[id] = @class;
     }
 }
예제 #8
0
        private void CreateNewSolution()
        {
            //Workspace
            m_WorkspaceDoc          = new WorkSpaceClass();
            MAINTREE_UI.ItemsSource = m_WorkspaceDoc.p_Solutions;

            ProjectClass prj = new ProjectClass
            {
                p_Name     = "Project1",
                p_Pareants = m_WorkspaceDoc.p_Solutions[0]
            };

            TaskClass tsk = new TaskClass
            {
                p_Name     = "Task1",
                p_Pareants = prj
            };

            ToolClass tl = new ToolClass
            {
                p_Name     = "Tool1",
                p_Pareants = tsk
            };

            m_WorkspaceDoc.p_Solutions[0].p_Projects.Add(prj);
            prj.p_Tasks.Add(tsk);
            tsk.p_Tools.Add(tl);

            m_convTreeviewItem = new ConvTreeViewItem();
        }
예제 #9
0
        /// <summary>
        /// 处理表单post数据
        /// </summary>
        private DocBody ProcessFormPost()
        {
            ProjectClass pjt = new ProjectClass();
            int          cstRightToApproveDocument = 2;

            // 验证
            if (Request.IsAuthenticated)
            {
                // 处理表单传递参数
                DocBody docbody = new DocBody();
                docbody.DocTitle       = this.txtTitle.Value;
                docbody.DocContent     = this.txtContent.Value;
                docbody.DocAddedBy     = Username;
                docbody.DocClassID     = Int32.Parse(ClassID);
                docbody.DocAddedDate   = DateTime.Now.ToString();
                docbody.DocApprover    = (pjt.GetAccessPermission(Int32.Parse(ClassID), Username, cstRightToApproveDocument))?Username:"";
                docbody.DocApproveDate = (pjt.GetAccessPermission(Int32.Parse(ClassID), Username, cstRightToApproveDocument))?DateTime.Now.ToString():"";
                docbody.DocApproved    = (docbody.DocApprover == "")?0:1;
                docbody.DocAttribute   = 0;
                docbody.DocType        = 0;
                return(docbody);
            }
            else
            {
                return(null);
            }
        }
예제 #10
0
파일: Write.cs 프로젝트: ccslabs/OSDevIDE
        /// <summary>
        /// This Method physically saves the project and is used internally.
        /// </summary>
        /// <param name="projectClass">
        /// Class: Contains information about the project being created
        /// </param>
        /// <param name="saveFileToLocation">
        /// string: The location where the Project File should be saved to.
        /// </param>
        /// <returns>
        /// Bool: True if the save was successful
        /// Bool: False if the save failed
        /// </returns>
        private bool SaveProjectTo(ProjectClass projectClass, string saveFileToLocation)
        {
            FileStream   fs = null;
            StreamWriter sw = null;

            try
            {
                fs = new FileStream(saveFileToLocation, FileMode.CreateNew, FileAccess.Write, FileShare.None);
                sw = new StreamWriter(fs);

                sw.WriteLine(projectClass.ApplicationName);
                sw.WriteLine(projectClass.ProjectName);
                sw.WriteLine(projectClass.ProjectSaveLocation);
                sw.WriteLine(projectClass.ProjectCreatedOn.ToString());

                sw.Close();
                fs.Close();
                return(true);
            }
            catch (Exception)
            {
                if (sw != null)
                {
                    sw.Close();
                }
                if (fs != null)
                {
                    fs.Close();
                }
            }
            return(false);
        }
예제 #11
0
        public ActionResult GetResults(InitParams init)
        {
            //string fileName = System.Web.HttpContext.Current.Server.MapPath(@"..\api\Ken-Tough-Room-Vertical-v2.dxf");
            //string fileName = System.Web.HttpContext.Current.Server.MapPath(@"..\api\Ken-Crazy-Colo.dxf");
            string fileName = getFileName(init); System.Web.HttpContext.Current.Server.MapPath(string.Format(@"..\api\{0}.dxf", init.FileName));


            ProjectClass project = getProject();

            createOptimizer(fileName, init, project);

            //start the operation that raises events which communicate back with the client
            optimizer.Optimize();


            JsonResult js = new JsonResult
            {
                JsonRequestBehavior = JsonRequestBehavior.AllowGet,
                Data = new
                {
                    universePoints   = optimizer.GetUniverse(),
                    floor            = project.Floor,
                    obstaclePointArr = optimizer.GetObstaclesPoints(),
                    boxArr           = optimizer.Boxes2relo.Select(b => new { points = b.PointsCollection, boxId = b.BoxId, shadowArr = b.ShadowPath.ToArray() }).ToArray()
                }
            };


            return(js);
        }
예제 #12
0
 public DataType(int DataTypeID, string DataTypeName, bool IsDataTypePrimitive, ProjectClass pClass)
 {
     _ID              = DataTypeID;
     _Name            = DataTypeName;
     _IsPrimitive     = IsDataTypePrimitive;
     _AssociatedClass = pClass;
 }
예제 #13
0
    private static string getPropertyText(ProjectClass pClass, ClassVariable classVar, string namSpace,
                                          language lang, CodeGeneration.Format codeFormat, string DAL = "")
    {
        DataType      mDataType             = classVar.ParameterType;
        string        nameWithUnderscore    = "_" + classVar.Name;
        string        nameWithoutUnderScore = classVar.Name;
        StringBuilder retStrB = new StringBuilder();

        retStrB.Append(cg.getMetaDataText(string.Format("Gets or sets the {0} for this {1}.{2} object.",
                                                        nameWithoutUnderScore, pClass.NameSpaceVariable.NameBasedOnID, pClass.Name.Text()),
                                          false, (int)tab.XX, lang, mDataType.Name(), namSpace));
        string propertyAttribute = "";

        if (classVar.IsPropertyXMLIgnored)
        {
            propertyAttribute = cg.GetByLanguage(lang, "<XmlIgnore()> ", "[XmlIgnore]");
        }

        if (cg.isRegularDataType(mDataType.Name()) | DAL.Length == 0)
        {
            retStrB.Append(getPropertyStringForRegularType(classVar, propertyAttribute,
                                                           nameWithoutUnderScore, nameWithUnderscore, lang, codeFormat));
        }
        else
        {
            retStrB.Append(getPropertyStringForDerivedObject(pClass, classVar, propertyAttribute,
                                                             nameWithoutUnderScore, nameWithUnderscore, mDataType, namSpace, DAL, lang, codeFormat));
        }

        return(retStrB.ToString());
    }
예제 #14
0
        /// <summary>
        /// 添加项目
        /// </summary>
        private void AddProject()
        {
            ProjectClass prj        = new ProjectClass();
            HttpCookie   UserCookie = Request.Cookies["Username"];
            String       Username   = UserCookie.Value.ToString();

            if (DateTime.Parse(this.txtStartDate.Text.ToString()) > DateTime.Parse(this.txtEndDate.Text.ToString()))
            {
                Response.Write("<script language=javascript>alert('开始时间不能大于结束时间!');</script>");
            }
            else
            {
                try
                {
                    prj.Add(Int32.Parse(ClassID), this.txtClassName.Value.ToString(), this.txtBrief.Value.ToString(),
                            Username, Int32.Parse(this.Status.SelectedIndex.ToString()), Int32.Parse(this.txtScale.Value.ToString()),
                            DateTime.Parse(this.txtStartDate.Text.ToString()), DateTime.Parse(this.txtEndDate.Text.ToString()));

                    prj = null;
                    Response.Write("<script language=javascript>alert('添加成功!');parent.LeftFrame.location='ProjectTreeView.aspx?classID=" + ClassID + "';</script>");
                }
                catch (Exception ex)
                {
                    UDS.Components.Error.Log(ex.ToString());
                    Server.Transfer("../Error.aspx");
                }
            }
        }
예제 #15
0
    private static string getEntireClassInVB(ProjectClass pClass, string objName, string namSpace, string Comments, string creator, CodeGeneration.Format codeFormat)
    {
        StringBuilder retStrB    = new StringBuilder();
        string        properties = getProperties(pClass, language.VisualBasic, codeFormat);

        retStrB.AppendLine("'Created By: " + creator + " (using Code generator)");
        retStrB.AppendLine("'Created On: " + DateTime.Now.ToString());
        retStrB.AppendLine("Option Strict On");
        retStrB.AppendLine("Imports Microsoft.VisualBasic");
        retStrB.AppendLine("Imports System.Collections.Generic");
        if (codeFormat == CodeGeneration.Format.MVC)
        {
            retStrB.AppendLine("Imports System.ComponentModel.DataAnnotations");
        }
        if (properties.ToLower().Contains("xmlignore"))
        {
            retStrB.AppendLine("Imports System.Xml.Serialization");
        }
        retStrB.AppendLine("Namespace " + namSpace);
        retStrB.AppendLine(cg.getMetaDataText(Comments, false, (int)tab.XX, language.VisualBasic));
        retStrB.AppendLine(Strings.Space((int)tab.X) + "Public Class " + objName);
        bool overridesBase = false;

        if (pClass.BaseClass != null && !string.IsNullOrEmpty(pClass.BaseClass.Name))
        {
            retStrB.AppendLine(Strings.Space((int)tab.X) + "Inherits " + pClass.BaseClass.Name);
            overridesBase = pClass.BaseClass.Name.ToLower().Contains("databaserecord");
        }
        retStrB.AppendLine("");
        retStrB.Append(getCodeBody(objName, pClass, properties, overridesBase, language.VisualBasic));
        retStrB.AppendLine(Strings.Space((int)tab.X) + "End Class");
        retStrB.AppendLine("End Namespace");

        return(retStrB.ToString());
    }
예제 #16
0
    private static string getCodeBody(string objName, ProjectClass pClass, string properties, bool overridesBaseObject, language lang)
    {
        StringBuilder strB = new StringBuilder();

        strB.AppendLine(cg.getRegionStart(lang, "Constructors"));
        strB.AppendLine(getConstructors(objName, lang));
        strB.AppendLine(cg.getRegionEnd(lang));
        strB.AppendLine("");
        strB.AppendLine(cg.getRegionStart(lang, "Database String"));
        strB.AppendLine(getDatabaseStrings(pClass, lang));
        strB.AppendLine(cg.getRegionEnd(lang));
        strB.AppendLine("");
        strB.AppendLine(cg.getRegionStart(lang, "Private Variables"));
        strB.AppendLine(getPrivateVariables(pClass, lang));
        strB.AppendLine(cg.getRegionEnd(lang));
        strB.AppendLine("");
        strB.AppendLine(cg.getRegionStart(lang, "Public Properties"));
        strB.AppendLine(properties);
        strB.AppendLine(cg.getRegionEnd(lang));
        strB.AppendLine("");
        strB.AppendLine(cg.getRegionStart(lang, "Public Functions"));
        strB.AppendLine(getAddUpdateFunctions(pClass, overridesBaseObject, lang));
        strB.AppendLine(cg.getRegionEnd(lang));
        strB.AppendLine("");
        strB.AppendLine(cg.getRegionStart(lang, "Public Subs"));
        strB.AppendLine(getDataReaderText(pClass, overridesBaseObject, lang));
        strB.AppendLine(cg.getRegionEnd(lang));
        strB.AppendLine("");
        strB.AppendLine(getToStringFunction(objName, lang));
        return(strB.ToString());
    }
    public static string getAllItemsSprocText(ProjectClass pClass)
    {
        string retString = "CREATE PROCEDURE dbo.sproc" + pClass.Name.PluralAndCapitalized + "GetAll" + Constants.vbCrLf + "AS" + Constants.vbCrLf;

        retString += getSelectText("SELECT * FROM " + pClass.DatabaseTableName);
        return(retString);
    }
예제 #18
0
        // 设置缺省值
        public void ShowAvailable()
        {
            ProjectClass pjt = new ProjectClass();

            UserCookie = Request.Cookies["Username"];
            string Username = UserCookie.Value.ToString();
            int    classID  = Int32.Parse(ClassID);
            int    cstRightToApproveDocument = 2;
            int    cstRightToViewDocument    = 10;
            int    cstRightToBuildNode       = 5;
            int    cstDisplayMember          = 6;
            int    cstTeamRight      = 7;
            int    cstComposeMail    = 11;
            int    cstDeliveryDoc    = 11;
            int    cstProjectMove    = 12;
            int    cstProjectCopy    = 12;
            int    cstDeleteDocument = 3;

            this.lblManageDirectory.Visible  = pjt.GetAccessPermission(classID, Username, cstRightToBuildNode);
            this.lblDeliveryDoc.Visible      = pjt.GetAccessPermission(classID, Username, cstDeliveryDoc);
            this.lblShowMember.Visible       = pjt.GetAccessPermission(classID, Username, cstDisplayMember);
            this.lblManagePermission.Visible = pjt.GetAccessPermission(classID, Username, cstTeamRight);
            this.lnkbtnDelete.Visible        = pjt.GetAccessPermission(classID, Username, cstDeleteDocument);
            this.lblRemove.Visible           = pjt.GetAccessPermission(classID, Username, cstProjectMove);
            this.lblCopy.Visible             = pjt.GetAccessPermission(classID, Username, cstProjectMove);
            pjt = null;
        }
예제 #19
0
        public ProjectView(string ID, ProjectClass Project, ListView Site, EventClass IPHelper)
        {
            _IPHelper         = IPHelper;
            main              = Site;
            Site.SelectedItem = false;
            InitializeComponent();
            _projectID = Project.ID;
            userID     = ID;


            Datapath = $"Data Source= " + Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + @"\PawloCore\" + ID + @"_user_data" + @"\DynamicsData\dynamics.sqlite";


            this.DataContext = this;

            TaskHelper.GetTaskList(_projectID, ID, TaskView);


            //Assignments
            ProjectLbl.Content  = Project.Name;
            ProgressLbl.Content = Progressbar.Value + "%";
            if (Project.DESCRIPTION != null)
            {
                DescriptionBlock.Text = Project.DESCRIPTION;
            }
            else
            {
                DescriptionBlock.Text = "Brak opisu";
            }

            TaskHelper.GetProgress(Datapath, _projectID, Progressbar);
            ProgressLbl.Content = TaskHelper.progressValue + "%";
            CheckLabel(projectDoneLbl, TaskHelper);
        }
예제 #20
0
    private string generateContentHeaders(ProjectClass pClass, bool isEditForm, bool useLists, language lang)
    {
        System.Text.StringBuilder retStr = new System.Text.StringBuilder();
        retStr.AppendLine("<asp:Content ID=\"ct" + pClass.MasterPage.TitleName + "\" ContentPlaceHolderID=\"cph"
                          + pClass.MasterPage.TitleName + "\" Runat=\"Server\">");
        retStr.AppendLine(Strings.Space((int)tab.X) + "<asp:Literal ID=\"lit" + pClass.MasterPage.TitleName + "\" runat=\"server\"></asp:Literal>");
        retStr.AppendLine("</asp:Content>");
        retStr.AppendLine();
        retStr.AppendLine("<asp:Content ID=\"ct" + pClass.MasterPage.SubTitleName + "\" ContentPlaceHolderID=\"cph"
                          + pClass.MasterPage.SubTitleName + "\" Runat=\"Server\">");
        retStr.AppendLine(Strings.Space((int)tab.X) + "<asp:Label ID=\"lbl" + pClass.MasterPage.SubTitleName + "\" runat=\"server\"></asp:Label>");
        retStr.AppendLine("</asp:Content>");
        retStr.AppendLine();
        retStr.AppendLine("<asp:Content ID=\"ct" + pClass.MasterPage.PageInstructionsName + "\" ContentPlaceHolderID=\"cph"
                          + pClass.MasterPage.PageInstructionsName + "\" Runat=\"Server\">");
        retStr.AppendLine(Strings.Space((int)tab.X) + "<asp:Label ID=\"lbl" + pClass.MasterPage.PageInstructionsName + "\" runat=\"server\"></asp:Label>");
        retStr.AppendLine("</asp:Content>");
        retStr.AppendLine();

        retStr.AppendLine("<asp:Content ID=\"ct" + pClass.MasterPage.BodyName + "\" ContentPlaceHolderID=\"cph"
                          + pClass.MasterPage.BodyName + "\" Runat=\"Server\">");
        if (isEditForm)
        {
            retStr.AppendLine(generateEditBody(pClass, useLists, lang));
        }
        else
        {
            retStr.AppendLine(getViewBody(pClass));
        }
        retStr.AppendLine("</asp:Content>");
        return(retStr.ToString());
    }
예제 #21
0
    public string getViewForm(ProjectClass pClass, bool useLists, language lang)
    {
        StringBuilder strB = new StringBuilder();

        strB.AppendLine(getHeaderLine(pClass, lang, pageVersion.View));
        strB.AppendLine(generateContentHeaders(pClass, false, useLists, lang));
        return(strB.ToString());
    }
예제 #22
0
        private void saveProject(ProjectClass project)
        {
            var jss   = new JavaScriptSerializer();
            var sJson = jss.Serialize(project);
            var path  = Server.MapPath("/Projects");

            System.IO.File.WriteAllText(Path.Combine(path, "data.json"), sJson);
        }
        protected void btnReject_Click(object sender, EventArgs e)
        {
            string qry = "UPDATE User_Business SET Request_Status='Cancel' WHERE BId=" + GridView1.SelectedRow.Cells[0].Text;

            ProjectClass.setrecords(qry);
            btnReject.Visible = false;
            btnAccept.Visible = false;
            GridView1.DataBind();
        }
 public static string getRemoveItemSprocText(ProjectClass pClass)
 {
     // TODO: Fix this to handle multiple Primary Keys
     return(string.Format("CREATE PROCEDURE dbo.sproc_{0}Remove{5}@{1} {2}{5}AS{5}BEGIN{5}"
                          + "{4}DELETE FROM {3}{5}{4}{4}WHERE {1} = @{1}{5}"
                          + "{5}{4}-- Return -1 if we had an error{5}"
                          + "{4}IF @@ERROR > 0{5}{4}BEGIN{5}{4}{4}RETURN -1{5}{4}END{5}{4}"
                          + "ELSE{5}{4}BEGIN{5}{4}{4}RETURN 1{5}{4}END{5}END{5}GO{5}{5}", pClass.Name.Capitalized(), pClass.ValueVariable.DatabaseColumnName, pClass.ValueVariable.DatabaseType, pClass.DatabaseTableName, Strings.Space((int)tabSize), Constants.vbCrLf));
 }
    public static string getSingleItemSprocText(ProjectClass pClass)
    {
        // TODO: Fix this to handle multiple Primary Keys
        string retString = "CREATE PROCEDURE dbo.sproc" + pClass.Name.Capitalized() + "Get" + Constants.vbCrLf;

        retString += "@" + pClass.ValueVariable.DatabaseColumnName + " " + pClass.ValueVariable.DatabaseType + Constants.vbCrLf + "AS" + Constants.vbCrLf;
        retString += getSelectText("SELECT * FROM " + pClass.DatabaseTableName + Constants.vbCrLf + Strings.Space((int)tabSize) + "WHERE " + pClass.ValueVariable.DatabaseColumnName + " = @" + pClass.ValueVariable.DatabaseColumnName);
        return(retString);
    }
예제 #26
0
    public static string getDALFunction_SelectSingle(ProjectClass pClass, string readConnection, cg.Language lang)
    {
        StringBuilder strB = new StringBuilder();

        strB.AppendLine(CodeGeneration.getMetaDataText("Gets the " + pClass.NameSpaceVariable.NameBasedOnID + "." + pClass.Name.Text()
                                                       + "corresponding with the given ID", false, (int)tab.XX, lang, pClass.Name.Capitalized()));

        string sprocName = "sproc" + pClass.Name.Capitalized() + "Get";

        if (lang == CodeGeneration.Language.VisualBasic)
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "Public Shared Function Get" + pClass.Name.Capitalized() + "(ByVal id As Integer) As " + pClass.Name.Capitalized());
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Dim comm As New SqlCommand(\"" + sprocName + "\")");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Dim retObj As " + pClass.Name.Capitalized() + " = Nothing ");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Try");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "With comm");
            strB.AppendLine(Strings.Space((int)tab.XXXXX) + getParaString(lang, pClass, "ID", "id"));
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "End With");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "Dim dr As SqlDataReader = GetDataReader(comm)");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "While dr.Read()");
            strB.AppendLine(Strings.Space((int)tab.XXXXX) + "retObj = New " + pClass.Name.Capitalized() + "(dr)");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "End While");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "comm.Connection.Close()");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Catch ex As Exception");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "comm.Connection.Close()");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "End Try");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Return retObj");
            strB.AppendLine(Strings.Space((int)tab.XX) + "End Function");
        }
        else
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "public static " + pClass.Name.Capitalized() + " Get" + pClass.Name.Capitalized() + "(int id)");
            strB.AppendLine(Strings.Space((int)tab.XX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "SqlCommand comm = new SqlCommand(\"" + sprocName + "\");");
            strB.AppendLine(Strings.Space((int)tab.XXX) + pClass.Name.Capitalized() + " retObj = null;");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "try");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + getParaString(lang, pClass, "ID", "id"));

            strB.AppendLine(Strings.Space((int)tab.XXXX) + "SqlDataReader dr = GetDataReader(comm);");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "while (dr.Read())");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXXXX) + "retObj = new " + pClass.Name.Capitalized() + "(dr);");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "comm.Connection.Close();");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "catch (Exception ex)");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "comm.Connection.Close();");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "return retObj;");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
        }
        strB.AppendLine();
        return(strB.ToString());
    }
예제 #27
0
    public static string getDALFunction_SelectAll(ProjectClass pClass, string readConnection, cg.Language lang)
    {
        StringBuilder strB = new StringBuilder();

        strB.Append(CodeGeneration.getMetaDataText("Gets a list of all " + pClass.NameSpaceVariable.NameBasedOnID + "." + pClass.Name.Capitalized()
                                                   + " objects from the database.", false, (int)tab.XX, lang,
                                                   cg.GetByLanguage(lang, "List(Of ", "List<")
                                                   + pClass.NameSpaceVariable.NameBasedOnID + "." + pClass.Name.Capitalized()
                                                   + cg.GetByLanguage(lang, ")", ">")));
        string sprocName = "sproc" + pClass.Name.PluralAndCapitalized + "GetAll";

        if (lang == CodeGeneration.Language.VisualBasic)
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "Public Shared Function Get" + pClass.Name.PluralAndCapitalized
                            + "() As List(Of " + pClass.Name.Capitalized() + ")");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Dim comm As New SqlCommand(\"" + sprocName + "\")");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Dim retList As New List(Of " + pClass.Name.Capitalized() + ")");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Try");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "comm.CommandType = Microsoft.Data.CommandType.StoredProcedure");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "Dim dr As SqlDataReader = GetDataReader(comm)");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "While dr.Read()");
            strB.AppendLine(Strings.Space((int)tab.XXXXX) + "retList.Add(New " + pClass.Name.Capitalized() + "(dr))");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "End While");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "comm.Connection.Close()");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Catch ex As Exception");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "comm.Connection.Close()");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "End Try");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "Return retList");
            strB.AppendLine(Strings.Space((int)tab.XX) + "End Function");
        }
        else
        {
            strB.AppendLine(Strings.Space((int)tab.XX) + "public static List<" + pClass.Name.Capitalized() + "> Get" + pClass.Name.PluralAndCapitalized + "()");
            strB.AppendLine(Strings.Space((int)tab.XX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "SqlCommand comm = new SqlCommand(\"" + sprocName + "\");");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "List<" + pClass.Name.Capitalized() + "> retList = new List<" + pClass.Name.Capitalized() + ">();");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "try");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "comm.CommandType = Microsoft.Data.CommandType.StoredProcedure;");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "SqlDataReader dr = GetDataReader(comm);");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "while (dr.Read())");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXXXX) + "retList.Add(new " + pClass.Name.Capitalized() + "(dr));");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "comm.Connection.Close();");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "catch (Exception ex)");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "{");
            strB.AppendLine(Strings.Space((int)tab.XXXX) + "comm.Connection.Close();");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "}");
            strB.AppendLine(Strings.Space((int)tab.XXX) + "return retList;");
            strB.AppendLine(Strings.Space((int)tab.XX) + "}");
        }
        strB.AppendLine();
        return(strB.ToString());
    }
예제 #28
0
 public WebSocketController()
 {
     Project                        = new ProjectClass("BCSApp");
     WebSocketClient                = new WebSocket(string.Format("ws://{0}:{1}/", Project.Settings.WebSocketServerAddress, Project.Settings.WebSocketServerPort));
     WebSocketClient.OnMessage     += OnWebSocketMessage;
     WebSocketClient.OnOpen        += OnOpen;
     ConnectToWebSocketServerThread = new Thread(ConnectToWebSocketServer);
     InputQueueProcessing           = new Thread(InputQueueProcessingThread);
     OutputQueueProcessing          = new Thread(OutputQueueProcessingThread);
 }
예제 #29
0
    public override bool Equals(object obj)
    {
        if (obj == null | this.GetType() != obj.GetType())
        {
            return(false);
        }
        ProjectClass pc = (ProjectClass)obj;

        return(pc.ID == this.ID);
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            string s = "select * from User_Business";

            using (SqlDataReader dr = ProjectClass.getRecords(s))
            {
                Repeater1.DataSource = dr;
                Repeater1.DataBind();
            }
        }
예제 #31
0
 /// <summary>
 /// Use the static create method.
 /// </summary>
 public MetaAvmProject()
 {
     Project = new ProjectClass();
     infoTextWriter = Console.Out;
     errorTextWriter = Console.Error;
 }