Exemplo n.º 1
0
        private void refreshList()
        {
            TEMPOServerProxy tsp = TEMPO.RequestBroker.TEMPOServerProxy.Instance;
            EmployeeDS       eds = tsp.GetAllEmployees();

            ctv.refreshTree(eds);
        }
Exemplo n.º 2
0
        //Init
        private void initConstructor(DBMAINContext poDB)
        {
            //DBContext
            this.db = poDB;
            //VM
            this.oVM = new TaskVM();
            //DS
            this.oDS              = new TaskDS(this.db);
            this.oDSDetail        = new TaskdDS(this.db);
            this.oDSDetail_worker = new Taskd_workerDS(this.db);
            this.oDSEmployee      = new EmployeeDS(this.db);
            this.oDSEmployeeuser  = new EmployeeuserDS(this.db);
            this.oDSMonth         = new MonthDS(this.db);
            this.oDSYear          = new YearDS(this.db);
            this.oDSProgresssts   = new ProgressstsDS(this.db);
            this.oDSValidatests   = new ValidatestsDS(this.db);
            this.oDSProject       = new ProjectDS(this.db);
            //CRUD
            this.oCRUD = new Task_workerCRUD(this.db);

            //BL
            //MAP
            //JSON
            JsSerialize = new JavaScriptSerializer();
        } //End initConstructor
Exemplo n.º 3
0
        public EmployeeCRUDPanel() : base(new Point(20, 140), new Size(820, 430), "EmployeeCRUD", false)
        {
            // background
            this.setGraphic(new Bitmap(typeof(TEMPO.Client.MainScreen), "Resources.CRUDpanel.png"));

            // obtain the data from the server
            TEMPOServerProxy tsp = TEMPO.RequestBroker.TEMPOServerProxy.Instance;
            EmployeeDS       eds = tsp.GetAllEmployees();

            // populate the control
            ctv = new CRUDTreeViewDS("Employees", eds, "EmployeeName");
            // assign the event handler
            ctv.onCRUDItemClicked += new CRUDTreeViewDS.CRUDItemClickedDelegate(openEntity);
            ctv.Location           = new Point(32, 71);
            ctv.Size = new Size(306, 222);

            this.Controls.Add(ctv);

            entrypanel                     = new EmployeeCRUDEntryPanel(EmployeeCRUDEntryPanel.EntryType.Save);
            entrypanel.Visible             = false;
            entrypanel.onRecordMaintained += new EmployeeCRUDEntryPanel.RecordMaintainDelegate(refreshList);
            this.Controls.Add(entrypanel);

            createpanel                     = new EmployeeCRUDEntryPanel(EmployeeCRUDEntryPanel.EntryType.Create);
            createpanel.Visible             = false;
            createpanel.onRecordMaintained += new EmployeeCRUDEntryPanel.RecordMaintainDelegate(refreshList);
            this.Controls.Add(createpanel);

            create = new GraphicButton(new Point(180, 315), new Size(155, 28));
            create.setGraphic(new Bitmap(typeof(TEMPO.Client.MainScreen), "Resources.addnewdocument.png"));
            create.Click += new System.EventHandler(newRecord);
            this.Controls.Add(create);
        }
Exemplo n.º 4
0
        public void Update(EmployeeDS ds)
        {
            string        sql;
            SqlConnection conn = new SqlConnection(this.DBConnectionString);

            sql = "insert into Employee (EmployeeName, Password, Rate, Active) values (@EmployeeName, @Password, @Rate, @Active); SELECT @@IDENTITY as EmpID";
            SqlCommand insertCommand = new SqlCommand(sql, conn);

            insertCommand.Parameters.Add("@EmployeeName", System.Data.SqlDbType.VarChar, 255, "EmployeeName");
            insertCommand.Parameters.Add("@Password", System.Data.SqlDbType.VarChar, 15, "Password");
            insertCommand.Parameters.Add("@Rate", System.Data.SqlDbType.Decimal, 9, "Rate");
            insertCommand.Parameters.Add("@Active", System.Data.SqlDbType.Bit, 1, "Active");
            insertCommand.UpdatedRowSource = UpdateRowSource.FirstReturnedRecord;

            sql = "update Employee set EmployeeName = @EmployeeName, Password = @Password, Rate = @Rate, Active = @Active Where Empid = @EmpID";
            SqlCommand updateCommand = new SqlCommand(sql, conn);

            updateCommand.Parameters.Add("@EmployeeName", System.Data.SqlDbType.VarChar, 255, "EmployeeName");
            updateCommand.Parameters.Add("@Password", System.Data.SqlDbType.VarChar, 15, "Password");
            updateCommand.Parameters.Add("@Rate", System.Data.SqlDbType.Decimal, 9, "Rate");
            updateCommand.Parameters.Add("@Active", System.Data.SqlDbType.Bit, 1, "Active");
            updateCommand.Parameters.Add("@EmpID", System.Data.SqlDbType.Int, 4, "EmpID");

            sql = "delete from Employee Where Empid = @EmpID";
            SqlCommand deleteCommand = new SqlCommand(sql, conn);

            deleteCommand.Parameters.Add("@EmpID", System.Data.SqlDbType.Int, 4, "EmpID");

            try {
                SqlHelper.UpdateDataset(insertCommand, deleteCommand, updateCommand, ds, "Employee");
            }
            catch {
                throw new Exception();
            }
        }
Exemplo n.º 5
0
        public override global::System.Data.DataSet Clone()
        {
            EmployeeDS cln = ((EmployeeDS)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Exemplo n.º 6
0
        public void CreateEmployee(EmployeeDS ds, int[] roles)
        {
            EmployeeDALC edalc = new EmployeeDALC();

            edalc.Update(ds);

            AuthorizationDALC adalc = new AuthorizationDALC();

            adalc.UpdateRoles(roles, ds.Employee[0].EmpID);
        }
Exemplo n.º 7
0
        public void UpdateEmployees(EmployeeDS ds, int[] roles, int empid)
        {
            EmployeeDALC edalc = new EmployeeDALC();

            edalc.Update(ds);

            AuthorizationDALC adalc = new AuthorizationDALC();

            adalc.UpdateRoles(roles, empid);
        }
Exemplo n.º 8
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            EmployeeDS ds = new EmployeeDS();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Exemplo n.º 9
0
        //BL
        //MAP


        //Init
        private void initConstructor(DBMAINContext poDB)
        {
            //DBContext
            this.db = poDB;
            //VM
            this.oVM = new TaskreportVM();
            //DS
            this.oDS         = new TaskreportDS(this.db);
            this.oDSEmployee = new EmployeeDS(this.db);
            //CRUD
            //this.oCRUD = new TaskreportCRUD(this.db);

            //BL
            //MAP
        } //End initConstructor
Exemplo n.º 10
0
        //BL
        //MAP

        //Init
        private void initConstructor(DBMAINContext poDB)
        {
            //DBContext
            this.db = poDB;
            //VM
            this.oVM = new EmployeeVM();
            //DS
            this.oDS         = new EmployeeDS(this.db);
            this.oDSUnit     = new UnitDS(this.db);
            this.oDSJobtitle = new JobtitleDS(this.db);
            //CRUD
            this.oCRUD = new EmployeeCRUD(this.db);

            //BL
            //MAP
        } //End initConstructor
Exemplo n.º 11
0
        } //End public static void setValidCredential(User_DetailVM poViewmodel)

        public static void setEmployee_Jobinfo(string psRES_RUID)
        {
            if ((psRES_RUID != null) && (psRES_RUID != ""))
            {
                EmployeeDS oDS = new EmployeeDS();
                //EmployeeJobinfo oVM = oDS.getData_Jobinfo(psRES_RUID);
                Employee_jobattrVM oVM = oDS.getData_jobattr(psRES_RUID);

                hlpConfig.SessionInfo.setAppUsrRES_RUID(psRES_RUID);
                hlpConfig.SessionInfo.setAppUsrRES_NM(oVM.RES_NM1);

                hlpConfig.SessionInfo.setAppUsrDEPT_RUID(oVM.DEPT_RUID);
                hlpConfig.SessionInfo.setAppUsrDEPT_NM(oVM.DEPT_NM);

                hlpConfig.SessionInfo.setAppUsrJOBTTL_RUID(oVM.JOB_TITLE_RUID);
                hlpConfig.SessionInfo.setAppUsrJOBTTL_NM(oVM.JOB_TITLE_NM);
            } //End if ((psRES_RUID != null) && (psRES_RUID != ""))
        }     //End public static void setEmployee_Jobinfo(string psRES_RUID)
Exemplo n.º 12
0
        /// <summary>
        /// Authenticate a user and return their ID
        /// </summary>
        /// <param name="username">the username of the user to authenticate</param>
        /// <param name="password">the password of the user to authenticate</param>
        /// <returns></returns>
        public int AuthenticateUser(string username, string password)
        {
            DbCommand command = tempodb.GetStoredProcCommand("GetEmployee");

            // assign the paramater
            tempodb.AddInParameter(command, "@employeename", DbType.String, username);
            tempodb.AddInParameter(command, "@password", DbType.String, password);
            // build the empty data set
            EmployeeDS employeeds = new EmployeeDS();

            // populate the dataset
            tempodb.LoadDataSet(command, employeeds, new string[] { "Employee" });
            if (employeeds.Employee.Count != 0)
            {
                return(employeeds.Employee[0].EmpID);
            }
            else
            {
                return(-1);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Get a specific Employee
        /// </summary>
        /// <param name="employeeid">the id of the employee to get</param>
        /// <returns>a strongly typed employee data set</returns>
        public EmployeeDS GetAllEmployees()
        {
            string sql;

            sql = "select * from Employee;";

            EmployeeDS empds = new EmployeeDS();

            string[] tables = new string[] { "Employee" };

            SqlParameter[] sqlparams = new SqlParameter[5];

            SqlParameter temp = new SqlParameter("@EmpID", SqlDbType.Int, 4, "EmpID");

            temp.Direction = System.Data.ParameterDirection.Output;
            sqlparams[0]   = temp;

            temp           = new SqlParameter("@EmployeeName", SqlDbType.VarChar, 4, "EmployeeName");
            temp.Direction = System.Data.ParameterDirection.Output;
            sqlparams[1]   = temp;

            temp           = new SqlParameter("@Password", SqlDbType.VarChar, 4, "Password");
            temp.Direction = System.Data.ParameterDirection.Output;
            sqlparams[2]   = temp;

            temp           = new SqlParameter("@Rate", SqlDbType.Decimal, 4, "Rate");
            temp.Direction = System.Data.ParameterDirection.Output;
            sqlparams[3]   = temp;

            temp           = new SqlParameter("@Active", SqlDbType.Bit, 4, "Active");
            temp.Direction = System.Data.ParameterDirection.Output;
            sqlparams[4]   = temp;

            SqlHelper.FillDataset(this.DBConnectionString, System.Data.CommandType.Text, sql, empds, tables, sqlparams);
            return(empds);
        }
Exemplo n.º 14
0
        } //End public static void setValidCredential()

        public static void setValidCredential(string psUsername = null, UsercredentialVM poViewmodel = null, int?pnMdleId = null)
        {
            hlpConfig.SessionInfo.setAppUsername(psUsername);
            hlpConfig.SessionInfo.setAppUserdisplayname(poViewmodel.DISPLAY_NAME);
            hlpConfig.SessionInfo.setAppUserId(poViewmodel.ID);
            hlpConfig.SessionInfo.setAppRoleId(poViewmodel.ROLE_ID);
            hlpConfig.SessionInfo.setAppResId(poViewmodel.RES_ID);
            hlpConfig.SessionInfo.setAppMdleId(pnMdleId);
            hlpConfig.SessionInfo.setAppUserIMG(poViewmodel.USER_IMG);


            string sTempinfo1 = "";
            string sTempinfo2 = "";
            string sTempinfo3 = "";
            string sTempinfo4 = "";
            string sIMG       = Utility_FileUploadDownload.getImage_UserNA();

            if (poViewmodel.ROLE_ID == APPBASE.Svcbiz.valFLAG.FLAG_ROLE_P)
            {
                StudentDS oDSStudent = new StudentDS();
                var       oData      = oDSStudent.getData_shortinfo(poViewmodel.RES_ID);
                if (oData != null)
                {
                    if (oData.STUDENT_IMG != null)
                    {
                        sIMG = Utility_FileUploadDownload.getImage_Student(oData.STUDENT_IMG);
                    }
                    sTempinfo1 = "";
                    if (oData.BRANCH_DESC != null)
                    {
                        sTempinfo1 = oData.BRANCH_DESC;
                    }
                    sTempinfo2 = "";
                    if (oData.CLASSTYPE_NAME != null)
                    {
                        sTempinfo2 = oData.CLASSTYPE_NAME;
                    }
                    sTempinfo3 = "";
                    if (oData.CLASSROOM_NAME != null)
                    {
                        sTempinfo3 = oData.CLASSROOM_NAME;
                    }
                    sTempinfo4 = "";
                    if (oData.CLASSTYPE_ID != null)
                    {
                        sTempinfo4 = oData.CLASSTYPE_ID.ToString();
                    }
                } //End if (oData != null)
            }     //End if (poViewmodel.ROLE_ID == APPBASE.Svcbiz.valFLAG.FLAG_ROLE_P)
            else
            {
                EmployeeDS oDSEmployee = new EmployeeDS();
                var        oData       = oDSEmployee.getData_shortinfo(poViewmodel.RES_ID);
                if (oData != null)
                {
                    if (oData.EMPLOYEE_IMG != null)
                    {
                        sIMG = Utility_FileUploadDownload.getImage_Employee(oData.EMPLOYEE_IMG);
                    }
                    sTempinfo1 = "";
                    if (oData.BRANCH_DESC != null)
                    {
                        sTempinfo1 = oData.BRANCH_DESC;
                    }
                    sTempinfo2 = "";
                    if (oData.SENTRA_NAME != null)
                    {
                        sTempinfo2 = oData.SENTRA_NAME;
                    }
                    sTempinfo3 = "";
                    if (oData.JOBTITLE_DESC != null)
                    {
                        sTempinfo3 = oData.JOBTITLE_DESC;
                    }
                } //End if (oData != null)
            }     //End if (poViewmodel.ROLE_ID == APPBASE.Svcbiz.valFLAG.FLAG_ROLE_P)
            hlpConfig.SessionInfo.setAppResIMG(sIMG);
            hlpConfig.SessionInfo.setAppResinfo1(sTempinfo1);
            hlpConfig.SessionInfo.setAppResinfo2(sTempinfo2);
            hlpConfig.SessionInfo.setAppResinfo3(sTempinfo3);
            hlpConfig.SessionInfo.setAppResinfo4(sTempinfo4);
        } //End public static void setValidCredential()
Exemplo n.º 15
0
            public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs)
            {
                global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
                global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
                EmployeeDS ds = new EmployeeDS();

                global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
                any1.Namespace       = "http://www.w3.org/2001/XMLSchema";
                any1.MinOccurs       = new decimal(0);
                any1.MaxOccurs       = decimal.MaxValue;
                any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any1);
                global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
                any2.Namespace       = "urn:schemas-microsoft-com:xml-diffgram-v1";
                any2.MinOccurs       = new decimal(1);
                any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
                sequence.Items.Add(any2);
                global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute1.Name       = "namespace";
                attribute1.FixedValue = ds.Namespace;
                type.Attributes.Add(attribute1);
                global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
                attribute2.Name       = "tableTypeName";
                attribute2.FixedValue = "EmployeeDataTable";
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
                if (xs.Contains(dsSchema.TargetNamespace))
                {
                    global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                    global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                    try {
                        global::System.Xml.Schema.XmlSchema schema = null;
                        dsSchema.Write(s1);
                        for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                        {
                            schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                            s2.SetLength(0);
                            schema.Write(s2);
                            if ((s1.Length == s2.Length))
                            {
                                s1.Position = 0;
                                s2.Position = 0;
                                for (; ((s1.Position != s1.Length) &&
                                        (s1.ReadByte() == s2.ReadByte()));)
                                {
                                    ;
                                }
                                if ((s1.Position == s1.Length))
                                {
                                    return(type);
                                }
                            }
                        }
                    }
                    finally {
                        if ((s1 != null))
                        {
                            s1.Close();
                        }
                        if ((s2 != null))
                        {
                            s2.Close();
                        }
                    }
                }
                xs.Add(dsSchema);
                return(type);
            }