// POST api/ccls
 public CanvasControlLibrary.Models.CanvasControlLibrary Post([FromBody]CanvasControlLibrary.Models.CanvasControlLibrary CCL)
 {
     UserCode uc = new UserCode();
     MethodInfo mi = uc.GetType().GetMethod(CCL.FunctionName);
     mi.Invoke(uc, new Object[] { CCL });
     return CCL;
 }
        private void SendData()
        {
            for (int i = 0; i < 10; i++)
            {
                var      container = Master.FindControl("Body");
                string[] input     = new string[10];

                for (int i2 = 0; i2 <= 4; i2++) //--Var
                {
                    string tbName = "tbEdit" + i.ToString() + i2.ToString();
                    var    txtBox = container.FindControl(tbName);

                    switch (i2)
                    {
                    case 0:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            goto track1;
                        }
                        else
                        {
                            input[i2] = _business.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        }
                        break;

                    case 1:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = "";
                        }
                        else
                        {
                            input[i2] = (((TextBox)txtBox).Text.ToString());
                        }
                        break;

                    case 2:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = "";
                        }
                        else
                        {
                            if (_business.IsValidEmail(((TextBox)txtBox).Text.ToString()))
                            {
                                input[i2] = (((TextBox)txtBox).Text.ToString());
                            }
                            else
                            {
                                //error---------------------------------------
                                input[i2] = "error invalid email";
                            }
                        }

                        break;

                    case 3:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = "";
                        }
                        else
                        {
                            if (_business.IsValidPhone(((TextBox)txtBox).Text.ToString()))
                            {
                                input[i2] = (((TextBox)txtBox).Text.ToString());
                            }
                            else
                            {
                                //error---------------------------------------
                                input[i2] = "error invalid phone";
                            }
                        }
                        break;

                    case 4:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = "";
                        }
                        else
                        {
                            if (_business.IsValidPhone(((TextBox)txtBox).Text.ToString()))
                            {
                                input[i2] = (((TextBox)txtBox).Text.ToString());
                            }
                            else
                            {
                                //error---------------------------------------
                                input[i2] = "error invalid phone";
                            }
                        }
                        break;
                    }
                }

                UserCode LoginUser = (UserCode)Session["authenticatedUser"];
                UserCode user      = GetCurrentUser(LoginUser.User_ID);

                DateTime dt      = DateTime.Now;
                string   dateNow = dt.ToString("yyyy-MM-dd");

                _business.AddCRA(input[0], input[1], input[2], input[3], input[4], user.User_ID.ToString(), dateNow, dateNow); //--Var

track1:
                continue;
            }
        }
Esempio n. 3
0
        private void ShowUserDetails(TreeNode node)
        {
            try
            {
                Snackboxx.Core.User user         = (Snackboxx.Core.User)node.Tag;
                List <UserCode>     UserCodelist = new List <UserCode>();
                tbuserid.Text     = user.userid;
                tbusername.Text   = user.username;
                tbloginname.Text  = user.loginname;
                tbemail.Text      = user.EMail;
                tbpassword.Text   = user.Password;
                tb_userLimit.Text = user.betragsLimit;
                lbcodes.Items.Clear();

                string        restquery = "Select rest from T_User where UserID='" + user.userid + "'";
                SqlDataReader dr        = _dbconn.GetResult(restquery, null);
                while (dr.Read())
                {
                    user.rest = dr.GetValue(0).ToString();
                }

                dr.Close();

                //UserRights
                for (int i = 0; i < cBUserRights.Items.Count; ++i)
                {
                    if (((UserRight)cBUserRights.Items[i]).userRightID == user.UserRightID)
                    {
                        cBUserRights.SelectedIndex = i;
                    }
                }

                decimal rest = Convert.ToDecimal(user.rest);
                if (rest > 0)
                {
                    btndeleteselcode.Enabled = false;
                }
                else
                {
                    btndeleteselcode.Enabled = true;
                }


                string query = "Select * from T_UserCodes where UserID='" + user.userid + "'";
                List <Dictionary <string, string> > UserCodes = _dbconn.GetResultList(query, null);
                for (int i = 0; i < UserCodes.Count; ++i)
                {
                    Dictionary <string, string> UserCode = UserCodes[i];
                    UserCode Ucode = new UserCode();
                    Ucode.UserID = user.userid;
                    foreach (string key in UserCode.Keys)
                    {
                        if (key.Equals("CodeID"))
                        {
                            Ucode.CodeID = UserCode[key];
                        }

                        if (key.Equals("UserCode"))
                        {
                            Ucode.userCode = UserCode[key];
                        }

                        if (key.Equals("Preis"))
                        {
                            Ucode.Preis = UserCode[key].Replace(",", ".");
                        }

                        if (key.Equals("IsSnackCode"))
                        {
                            Ucode.Issnackcode = Convert.ToBoolean(UserCode[key]);
                        }
                    }

                    lbcodes.Items.Add(Ucode);
                    UserCodelist.Add(Ucode);
                }

                user.usercodes = UserCodelist;
                node.Tag       = user;


                string sumquery = "Select * from T_Posten where UserID='" + user.userid + "'";
                List <Dictionary <string, string> > allposten = _dbconn.GetResultList(sumquery, null);
                labAllPosten.Text = allposten.Count.ToString();


                decimal openSum  = 0;
                decimal closeSum = 0;
                decimal allSum   = 0;
                for (int i = 0; i < allposten.Count; ++i)
                {
                    Dictionary <string, string> posten = allposten[i];
                    decimal preis = Convert.ToDecimal(posten["Preis"]);
                    allSum += preis;
                }

                closeSum = allSum - rest;
                openSum  = rest;

                laballSum.Text   = allSum.ToString().Replace(",", ".");
                labCloseSum.Text = closeSum.ToString().Replace(",", ".");
                labopenSum.Text  = openSum.ToString().Replace(",", ".");
            }
            catch (Exception exp)
            {
                //this.WriteLog(exp.Message);
            }
        }
Esempio n. 4
0
        private void toolStripMenuItemSave_Click(object sender, EventArgs e)
        {
            try
            {
                _saveButtonWasClicked = true;
                Snackboxx.Core.User user = new Snackboxx.Core.User();
                user.userid    = tbuserid.Text;
                user.username  = this.InsertParameterCheck(tbusername.Text);
                user.loginname = this.InsertParameterCheck(tbloginname.Text);
                if (tb_userLimit.Text == "0.00" || tb_userLimit.Text == "")
                {
                    user.betragsLimit     = SnackboxxForm.DEFAULT_LIMIT;
                    user.nextBetragsLimit = SnackboxxForm.DEFAULT_LIMIT;
                }
                else
                {
                    user.betragsLimit     = tb_userLimit.Text;
                    user.nextBetragsLimit = tb_userLimit.Text;
                }

                string password = null;
                if (!string.IsNullOrEmpty(tbpassword.Text))
                {
                    password = _crypt.EncryptMessage(this.InsertParameterCheck(tbpassword.Text), _cryptstr);
                }
                user.Password = tbpassword.Text;
                user.EMail    = this.InsertParameterCheck(tbemail.Text);
                if (cBUserRights.Items.Count > 0)
                {
                    user.UserRightID = ((UserRight)cBUserRights.SelectedItem).userRightID;
                }

                ParameterObj timeObj = new ParameterObj();
                timeObj.name  = "@Timer";
                timeObj.type  = SqlDbType.DateTime;
                timeObj.value = DateTime.Now;

                if (string.IsNullOrEmpty(tbuserid.Text)) //newUser
                {
                    #region newUser

                    if (!_dbconn.DataSetExists("Select * from T_User where UserName='******'", null))
                    {
                        string insert = "Insert into T_User(UserName,Password,EMail,UserRightID,LoginName,BetragsLimit,NextBetragsLimit)"
                                        + "values('" + user.username + "','" + password + "','" + user.EMail + "','" + user.UserRightID + "','" +
                                        user.loginname + "','" + user.betragsLimit + "','" + user.nextBetragsLimit + "')";
                        _dbconn.Execute(insert, null);
                        string        query = "Select UserID from T_User where UserName='******'";
                        SqlDataReader dr    = _dbconn.GetResult(query, null);
                        while (dr.Read())
                        {
                            user.userid = dr.GetValue(0).ToString();
                        }

                        dr.Close();
                        user.usercodes = new List <UserCode>();
                        for (int i = 0; i < lbcodes.Items.Count; ++i)
                        {
                            UserCode Ucode = (UserCode)lbcodes.Items[i];
                            user.usercodes.Add(Ucode);
                            string insertcode = "Insert into T_UserCodes(UserID,UserCode,Preis,IsSnackCode)"
                                                + "values('" + user.userid + "','" + Ucode.userCode + "','" + Ucode.Preis + "','" + Ucode.Issnackcode + "')";
                            _dbconn.Execute(insertcode, null);
                        }

                        List <ParameterObj> paramlist = new List <ParameterObj>();
                        paramlist.Add(timeObj);

                        string insertK = "Insert into T_UserTimeKonto(UserID,InHouse,UpdateTime)values('" + user.userid + "','false',@Timer)";
                        _dbconn.Execute(insertK, paramlist);

                        TreeNode node = new TreeNode();
                        node.Text = user.username;
                        node.Tag  = user;
                        tvuser.Nodes.Add(node);
                        _form.SettssinfoONE("User Add... User " + user.username + " with follow ID " + user.userid + " is inserted...");
                        //this.WriteLog("User Add... User " + username + " with follow ID " + user.userid + " is inserted...");
                    }
                    else
                    {
                        _form.SettssinfoONE("User exists in the Database... " + user.username);
                        //this.WriteLog("User exists in the Database... " + username);
                    }

                    //this.btnclear_Click(sender, e);

                    #endregion
                }
                else //olduser
                {
                    #region olduser

                    string queryupd = "Update T_User set UserName='******',Password='******',LoginName='" + user.loginname
                                      + "',EMail='" + user.EMail
                                      + "',UserRightID='" + user.UserRightID
                                      + "',BetragsLimit ='" + user.betragsLimit
                                      + "' where UserID='" + user.userid + "'";

                    _dbconn.Execute(queryupd, null);


                    string query = "Select * from T_UserCodes where UserID='" + user.userid + "'";
                    List <Dictionary <string, string> > oldCodes = _dbconn.GetResultList(query, null);

                    string kquery = "Select * from T_UserTimeKonto where UserID='" + user.userid + "'";
                    if (!_dbconn.DataSetExists(kquery, null))
                    {
                        List <ParameterObj> paramlist = new List <ParameterObj>();
                        paramlist.Add(timeObj);

                        string insertK = "Insert into T_UserTimeKonto(UserID,InHouse,UpdateTime)values('" + user.userid + "','false',@Timer)";
                        _dbconn.Execute(insertK, paramlist);
                    }

                    for (int i = 0; i < oldCodes.Count; ++i)
                    {
                        bool   exists = false;
                        string codeid = oldCodes[i]["CodeID"];
                        for (int j = 0; j < lbcodes.Items.Count; ++j)
                        {
                            UserCode code = (UserCode)lbcodes.Items[j];
                            if (codeid == code.CodeID)
                            {
                                exists = true;
                            }
                        }

                        if (!exists)
                        {
                            string check = "Select * from T_User where UserID='" + user.userid + "' and rest>=0";
                            if (!_dbconn.DataSetExists(check, null))
                            {
                                string delquery = "Delete from t_UserCodes where UserID='" + user.userid + "' and CodeID='" + codeid + "'";
                                _dbconn.Execute(delquery, null);
                            }
                        }
                    }

                    List <UserCode> UserCodelist = new List <UserCode>();
                    for (int i = 0; i < lbcodes.Items.Count; ++i)
                    {
                        UserCode code = (UserCode)lbcodes.Items[i];
                        if (string.IsNullOrEmpty(code.CodeID))
                        {
                            code.UserID = tbuserid.Text;
                            string insert = "Insert into T_UserCodes(UserID,UserCode,Preis,IsSnackCode)"
                                            + "values('" + code.UserID + "','" + code.userCode + "','" + code.Preis + "','" + code.Issnackcode + "')";
                            //this.WriteInfo(insert);
                            _dbconn.Execute(insert, null);
                        }
                    }

                    _form.SettssinfoONE("User Edit: User " + tbusername.Text + " was edit...");

                    //this.WriteLog("User Edit: User " + tbusername.Text + " was edit...");
                    tvuser.SelectedNode.ForeColor = Color.Black;
                    tvuser.SelectedNode.Tag       = user;

                    #endregion
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message + "\n" + exp.StackTrace);
                //this.WriteLog("UserSave ... Exception: " + exp.Message);
            }
        }
Esempio n. 5
0
        private void UpdateData()
        {
            List <int> ListDataIDs = GetDataIDs();

            for (int i = 0; i <= 9; i++)
            {
                string[] input     = new string[3];
                var      container = Master.FindControl("Body");

                for (int i2 = 0; i2 <= 2; i2++)
                {
                    string tbName = "tbEdit" + i.ToString() + i2.ToString();
                    var    txtBox = container.FindControl(tbName);

                    switch (i2)
                    {
                    case 0:
                        if (((TextBox)txtBox).Text != "")
                        {
                            input[i2] = _business.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        }
                        else
                        {
                            goto track1;
                        }
                        break;

                    case 1:
                        if (((TextBox)txtBox).Text == "")
                        {
                            if (_business.IsValidEmail(((TextBox)txtBox).Text.ToString()))
                            {
                                input[i2] = (((TextBox)txtBox).Text.ToString());
                            }
                            else
                            {
                                //error---------------------------------------
                            }
                        }
                        else
                        {
                            input[i2] = (((TextBox)txtBox).Text.ToString());
                        }
                        break;

                    case 2:
                        if (((TextBox)txtBox).Text == "")
                        {
                            if (_business.IsValidPhone(((TextBox)txtBox).Text.ToString()))
                            {
                                input[i2] = (((TextBox)txtBox).Text.ToString());
                            }
                            else
                            {
                                //error---------------------------------------
                            }
                        }
                        else
                        {
                            input[i2] = (((TextBox)txtBox).Text.ToString());
                        }
                        break;
                    }
                }


                string sortingPar1 = string.Format(" WHERE Department_ID = {0}", GetDataIDs()[i]);
                List <DepartmentCode> CurrentDepartment = new List <DepartmentCode>();
                CurrentDepartment = _business.GetDepartments(sortingPar1);

                //hospitalID krijgen van de current row in de gridvieuw
                int    hospitalID = CurrentDepartment[0].HospitalID;
                string ddName     = "ddEdit" + i.ToString() + 0.ToString();
                var    dd         = container.FindControl(ddName) as DropDownList;

                UserCode LoginUser = (UserCode)Session["authenticatedUser"];
                UserCode user      = GetCurrentUser(LoginUser.ID);

                DateTime dt      = DateTime.Now;
                string   dateNow = dt.ToString("yyyy-MM-dd");

                _business.UpdateDepartment(new DepartmentCode(ListDataIDs[i], input[0], input[1], input[2], Convert.ToInt16(dd.SelectedValue), user.ID, Convert.ToDateTime(dateNow), Convert.ToDateTime(dateNow)));
track1:
                continue;
            }
        }
Esempio n. 6
0
        private void SendData()
        {
            var container = Master.FindControl("Body");
            List <List <string> > ListContentHospital = _business.GetHospitalDropDownContent();

            for (int i = 0; i <= 9; i++)
            {
                string[] input = new string[10];

                for (int i2 = 0; i2 <= 9; i2++)
                {
                    string tbName = "tbEdit" + i.ToString() + i2.ToString();
                    var    txtBox = container.FindControl(tbName);

                    switch (i2)
                    {
                    case 0:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            goto track1;
                        }
                        else
                        {
                            input[i2] = _business.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        }
                        break;

                    case 1:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = "";
                        }
                        else
                        {
                            if (_business.IsValidEmail(((TextBox)txtBox).Text.ToString()))
                            {
                                input[i2] = (((TextBox)txtBox).Text.ToString());
                            }
                            else
                            {
                                //error---------------------------------------
                                input[i2] = "error invalid email";
                            }
                        }

                        break;

                    case 2:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = "";
                        }
                        else
                        {
                            if (_business.IsValidPhone(((TextBox)txtBox).Text.ToString()))
                            {
                                input[i2] = (((TextBox)txtBox).Text.ToString());
                            }
                            else
                            {
                                //error---------------------------------------
                                input[i2] = "error invalid phone";
                            }
                        }
                        break;
                    }
                }
                string ddName       = "ddEdit" + i.ToString() + "0";
                var    dropdownData = container.FindControl(ddName) as DropDownList;
                int    index        = dropdownData.SelectedIndex;

                UserCode LoginUser = (UserCode)Session["authenticatedUser"];
                UserCode user      = GetCurrentUser(LoginUser.ID);

                DateTime dt      = DateTime.Now;
                string   dateNow = dt.ToString("yyyy-MM-dd");

                _business.AddDepartment(new DepartmentCode(0, input[0], input[1], input[2], Convert.ToInt16(ListContentHospital[index - 1][0]), user.ID, Convert.ToDateTime(dateNow), Convert.ToDateTime(dateNow)));
track1:
                continue;
            }
        }
        private void UpdateData()
        {
            string lbName;
            var    listboxData = new ListBox();

            List <int> ListDataIDs = GetDataIDs();

            for (int i = 0; i < ListDataIDs.Count; i++)
            {
                var      container = Master.FindControl("Body");
                string[] input     = new string[10];

                for (int i2 = 0; i2 <= 2; i2++) //--Var
                {
                    string tbName = "tbEdit" + i.ToString() + i2.ToString();
                    var    txtBox = container.FindControl(tbName);

                    switch (i2)
                    {
                    case 0:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            goto track1;
                        }
                        else
                        {
                            input[i2] = _business.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        }
                        break;

                    case 1:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = DateTime.Today.ToString();
                        }
                        else
                        {
                            input[i2] = (((TextBox)txtBox).Text.ToString());
                        }
                        break;

                    case 2:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = DateTime.Today.ToString();
                        }
                        else
                        {
                            input[i2] = (((TextBox)txtBox).Text.ToString());
                        }
                        break;
                    }
                }

                UserCode LoginUser = (UserCode)Session["authenticatedUser"];
                UserCode user      = GetCurrentUser(LoginUser.User_ID);

                DateTime dt      = DateTime.Now;
                string   dateNow = dt.ToString("yyyy-MM-dd");

                _business.UpdateProject(ListDataIDs[i], input[0], Convert.ToDateTime(input[1]), Convert.ToDateTime(input[2]), user.User_ID.ToString(), dateNow); //--Var

                lbName      = "lbEdit" + i.ToString() + "0";
                listboxData = container.FindControl(lbName) as ListBox;

                _business.DeleteRelationProjectHasCRAs(ListDataIDs[i]); //--Var

                if (listboxData.SelectedIndex.ToString().Count() != 0)
                {
                    foreach (ListItem l in listboxData.Items)
                    {
                        if (l.Selected == true)
                        {
                            _business.AddCRAToProject(Convert.ToInt32(l.Value), ListDataIDs[i]); //--Var
                        }
                    }
                }

                lbName      = "lbEdit" + i.ToString() + "1";
                listboxData = container.FindControl(lbName) as ListBox;

                _business.DeleteRelationProjectHasDoctors(ListDataIDs[i]); //--Var

                if (listboxData.SelectedIndex.ToString().Count() != 0)
                {
                    foreach (ListItem l in listboxData.Items)
                    {
                        if (l.Selected == true)
                        {
                            _business.AddDoctorToProject(Convert.ToInt32(l.Value), ListDataIDs[i]); //--Var
                        }
                    }
                }

                lbName      = "lbEdit" + i.ToString() + "2";
                listboxData = container.FindControl(lbName) as ListBox;

                _business.DeleteRelationProjectHasHospitals(ListDataIDs[i]); //--Var

                if (listboxData.SelectedIndex.ToString().Count() != 0)
                {
                    foreach (ListItem l in listboxData.Items)
                    {
                        if (l.Selected == true)
                        {
                            _business.AddHospitalToProject(Convert.ToInt32(l.Value), ListDataIDs[i]); //--Var
                        }
                    }
                }

                lbName      = "lbEdit" + i.ToString() + "3";
                listboxData = container.FindControl(lbName) as ListBox;

                _business.DeleteRelationProjectHasProjectManagers(ListDataIDs[i]); //--Var

                if (listboxData.SelectedIndex.ToString().Count() != 0)
                {
                    foreach (ListItem l in listboxData.Items)
                    {
                        if (l.Selected == true)
                        {
                            _business.AddProjectManagerToProject(Convert.ToInt32(l.Value), ListDataIDs[i]); //--Var
                        }
                    }
                }
track1:
                continue;
            }
        }
Esempio n. 8
0
        private void checkListBoxOutputParameters_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            try
            {
                if (e.CurrentValue == CheckState.Checked && e.NewValue == CheckState.Unchecked)
                {
                    switch (UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].FuncID)
                    {
                    case ProCodeCls.MainFunction.InputCameraInputFBD:
                        break;

                    case ProCodeCls.MainFunction.CalibrationThresholdFBD:
                        break;

                    case ProCodeCls.MainFunction.CalibrationBackgroundRemoveFBD:
                        break;

                    case ProCodeCls.MainFunction.CalibrationMedianFilterFBD:
                        break;

                    case ProCodeCls.MainFunction.CalibrationMorphologyProcessingFBD:
                        break;

                    case ProCodeCls.MainFunction.MeasureBlobAnalysisFBD:
                    {
                        UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gBP.showOutputResultFlag[showTempFlag[e.Index]] = false;
                    }
                    break;

                    case ProCodeCls.MainFunction.MeasureShapeSearchFBD:
                    {
                        UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gSSP.showOutputResultFlag[e.Index] = false;
                    }
                    break;

                    case ProCodeCls.MainFunction.MeasureAnisoShapeSearchFBD:
                    {
                        UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].tAShpSrh.showOutputResultFlag[e.Index] = false;
                    }
                    break;

                    default:
                        break;
                    }
                }
                if (e.NewValue == CheckState.Checked && e.CurrentValue == CheckState.Unchecked)
                {
                    switch (UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].FuncID)
                    {
                    case ProCodeCls.MainFunction.InputCameraInputFBD:
                        break;

                    case ProCodeCls.MainFunction.CalibrationThresholdFBD:
                        break;

                    case ProCodeCls.MainFunction.CalibrationBackgroundRemoveFBD:
                        break;

                    case ProCodeCls.MainFunction.CalibrationMedianFilterFBD:
                        break;

                    case ProCodeCls.MainFunction.CalibrationMorphologyProcessingFBD:
                        break;

                    case ProCodeCls.MainFunction.MeasureBlobAnalysisFBD:
                    {
                        UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gBP.showOutputResultFlag[showTempFlag[e.Index]] = true;
                    }
                    break;

                    case ProCodeCls.MainFunction.MeasureShapeSearchFBD:
                    {
                        UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gSSP.showOutputResultFlag[e.Index] = true;
                    }
                    break;

                    case ProCodeCls.MainFunction.MeasureAnisoShapeSearchFBD:
                    {
                        UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].tAShpSrh.showOutputResultFlag[e.Index] = true;
                    }
                    break;

                    default:
                        break;
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 9
0
        private void SendData()
        {
            List <List <string> > ListContentProject = _business.GetProjectDropDownContent();
            List <List <string> > ListContentClient  = _business.GetClientDropDownContent();
            var container = Master.FindControl("Body");

            for (int i = 0; i <= 9; i++)
            {
                string[] input = new string[4];

                for (int i2 = 0; i2 <= 3; i2++)
                {
                    string tbName = "tbEdit" + i.ToString() + i2.ToString();
                    var    txtBox = container.FindControl(tbName);

                    switch (i2)
                    {
                    case 0:
                        if (((TextBox)txtBox).Text != "")
                        {
                            input[i2] = _business.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        }
                        else
                        {
                            goto track1;
                        }
                        break;

                    case 1:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = 0.ToString();
                            ;
                        }
                        else
                        {
                            input[i2] = (((TextBox)txtBox).Text.ToString());
                        }
                        break;

                    case 2:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = DateTime.Today.ToString();
                        }
                        else
                        {
                            input[i2] = (((TextBox)txtBox).Text.ToString());
                        }
                        break;

                    case 3:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = DateTime.Today.ToString();
                        }
                        else
                        {
                            input[i2] = (((TextBox)txtBox).Text.ToString());
                        }
                        break;
                    }
                }

                string ddNameProject       = "ddEdit" + i.ToString() + "0";
                var    dropdownDataProject = container.FindControl(ddNameProject) as DropDownList;
                int    indexProject        = dropdownDataProject.SelectedIndex;

                string ddNameClient       = "ddEdit" + i.ToString() + "1";
                var    dropdownDataClient = container.FindControl(ddNameClient) as DropDownList;
                int    indexClient        = dropdownDataClient.SelectedIndex;

                UserCode LoginUser = (UserCode)Session["authenticatedUser"];
                UserCode user      = GetCurrentUser(LoginUser.User_ID);

                DateTime dt      = DateTime.Now;
                string   dateNow = dt.ToString("yyyy-MM-dd");

                if (indexClient < 1 || indexProject < 1)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", "alert('Make sure you have selected a relation.')", true);
                }
                else
                {
                    _business.AddContract(input[0], Convert.ToDouble(input[1]), Convert.ToDateTime(input[2]), Convert.ToDateTime(input[3]), Convert.ToInt16(ListContentClient[indexClient - 1][0]), Convert.ToInt16(ListContentProject[indexProject - 1][0]), user.User_ID.ToString(), dateNow, dateNow);
                }
track1:
                continue;
            }
        }
Esempio n. 10
0
 public UserService()
 {
     this.userCode = new UserCode();
     this.config   = new MapperConfiguration(cfg => cfg.CreateMap <UserInputModel, UserDataModel>());
 }
        // Entry point to interpreter
        // User's code is passed as UserCode string
        public static LuaValue RunCode(string UserCode)
        {
            CodeReport = new UserCode();

            return Interpreter(UserCode, CreateGlobalEnviroment());
        }
   private SubsystemCommandBasedIterativeRobot(
    IterativeRobotConfiguration iterativeRobotConfiguration, 
    UserCode userCode,
    IDebugRenderContext debugRenderContext
 )
       : base(iterativeRobotConfiguration, userCode, debugRenderContext)
   {
   }
   public static IRobot Create(
    IterativeRobotConfiguration configuration,
    SCG.IReadOnlyDictionary<int, ISubsystem> subsystems,
    SCG.IReadOnlyList<ICommand> commands,
    IDebugRenderContext debugRenderContext
 )
   {
       var userCode = new UserCode(subsystems, commands);
        return new SubsystemCommandBasedIterativeRobot(configuration, userCode, debugRenderContext);
   }
Esempio n. 14
0
        private void UpdateData()
        {
            List <int> ListDataIDs = GetSessionDataIDs();

            for (int i = 0; i < ListDataIDs.Count; i++)
            {
                var      container = Master.FindControl("Body");
                string[] input     = new string[10];

                for (int i2 = 0; i2 <= 5; i2++) //--Var
                {
                    string tbName = "tbEdit" + i.ToString() + i2.ToString();
                    var    txtBox = container.FindControl(tbName);

                    switch (i2)
                    {
                    case 0:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            goto track1;
                        }
                        else
                        {
                            input[i2] = _business.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        }
                        break;

                    case 1:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = "";
                        }
                        else
                        {
                            input[i2] = (((TextBox)txtBox).Text.ToString());
                        }
                        break;

                    case 2:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = "";
                        }
                        else
                        {
                            if (_business.IsValidEmail(((TextBox)txtBox).Text.ToString()))
                            {
                                input[i2] = (((TextBox)txtBox).Text.ToString());
                            }
                            else
                            {
                                //error---------------------------------------
                                input[i2] = "error invalid email";
                            }
                        }

                        break;

                    case 3:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = "";
                        }
                        else
                        {
                            if (_business.IsValidPhone(((TextBox)txtBox).Text.ToString()))
                            {
                                input[i2] = (((TextBox)txtBox).Text.ToString());
                            }
                            else
                            {
                                //error---------------------------------------
                                input[i2] = "error invalid phone";
                            }
                        }
                        break;

                    case 4:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = "";
                        }
                        else
                        {
                            if (_business.IsValidPhone(((TextBox)txtBox).Text.ToString()))
                            {
                                input[i2] = (((TextBox)txtBox).Text.ToString());
                            }
                            else
                            {
                                //error---------------------------------------
                                input[i2] = "error invalid phone";
                            }
                        }
                        break;

                    case 5:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = "";
                        }
                        else
                        {
                            input[i2] = _business.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        }
                        break;
                    }
                }

                UserCode LoginUser = (UserCode)Session["authenticatedUser"];
                UserCode user      = GetCurrentUser(LoginUser.ID);

                DateTime dt      = DateTime.Now;
                string   dateNow = dt.ToString("yyyy-MM-dd");

                _business.UpdateStudyCoordinator(new StudyCoordinatorCode(ListDataIDs[i], input[0], input[1], input[2], input[3], input[4], input[5], user.ID, Convert.ToDateTime(dateNow), Convert.ToDateTime(dateNow))); //--Var

                string lbName      = "lbEdit" + i.ToString() + "0";
                var    listboxData = container.FindControl(lbName) as ListBox;

                _business.DeleteRelationStudyCoordinatorHasDoctors(ListDataIDs[i]); //--Var

                if (listboxData.SelectedIndex.ToString().Count() != 0)
                {
                    foreach (ListItem l in listboxData.Items)
                    {
                        if (l.Selected == true)
                        {
                            _business.AddDoctorToStudyCoordinator(Convert.ToInt32(l.Value), ListDataIDs[i]); //--Var
                        }
                    }
                }
track1:
                continue;
            }
        }
Esempio n. 15
0
        public virtual bool MessageRequestHandler(byte[] receivedMessage)
        {
            //Console.WriteLine("\n   _z_ [" + this.NodeId + "]  " + (this.DeviceHandler != null ? this.DeviceHandler.ToString() : "!" + this.GenericClass.ToString()));
            //Console.WriteLine("   >>> " + zp.ByteArrayToString(receivedMessage) + "\n");

            ZWaveEvent messageEvent  = null;
            int        messageLength = receivedMessage.Length;

            if (messageLength > 8)
            {
                //byte commandLength = receivedMessage[6];
                byte commandClass = receivedMessage[7];
                switch (commandClass)
                {
                case (byte)CommandClass.Basic:
                    messageEvent = Basic.GetEvent(this, receivedMessage);
                    break;

                case (byte)CommandClass.Alarm:
                    messageEvent = Alarm.GetEvent(this, receivedMessage);
                    break;

                case (byte)CommandClass.SensorAlarm:
                    messageEvent = SensorAlarm.GetEvent(this, receivedMessage);
                    break;

                case (byte)CommandClass.SceneActivation:
                    messageEvent = SceneActivation.GetEvent(this, receivedMessage);
                    break;

                case (byte)CommandClass.SwitchBinary:
                    messageEvent = SwitchBinary.GetEvent(this, receivedMessage);
                    break;

                case (byte)CommandClass.SwitchMultilevel:
                    messageEvent = SwitchMultilevel.GetEvent(this, receivedMessage);
                    break;

                case (byte)CommandClass.SensorBinary:
                    messageEvent = SensorBinary.GetEvent(this, receivedMessage);
                    break;

                case (byte)CommandClass.SensorMultilevel:
                    messageEvent = SensorMultilevel.GetEvent(this, receivedMessage);
                    break;

                case (byte)CommandClass.Meter:
                    messageEvent = Meter.GetEvent(this, receivedMessage);
                    break;

                case (byte)CommandClass.ThermostatMode:
                case (byte)CommandClass.ThermostatFanMode:
                case (byte)CommandClass.ThermostatFanState:
                case (byte)CommandClass.ThermostatHeating:
                case (byte)CommandClass.ThermostatOperatingState:
                case (byte)CommandClass.ThermostatSetBack:
                case (byte)CommandClass.ThermostatSetPoint:
                    messageEvent = Thermostat.GetEvent(this, receivedMessage);
                    break;

                case (byte)CommandClass.UserCode:
                    messageEvent = UserCode.GetEvent(this, receivedMessage);
                    break;

                case (byte)CommandClass.Association:
                    messageEvent = Association.GetEvent(this, receivedMessage);
                    break;

                case (byte)CommandClass.Configuration:
                    messageEvent = Configuration.GetEvent(this, receivedMessage);
                    break;

                case (byte)CommandClass.WakeUp:
                    messageEvent = WakeUp.GetEvent(this, receivedMessage);
                    break;

                case (byte)CommandClass.Battery:
                    messageEvent = Battery.GetEvent(this, receivedMessage);
                    break;

                case (byte)CommandClass.Hail:
                    Basic.Get(this);
                    break;

                case (byte)CommandClass.MultiInstance:
                    messageEvent = MultiInstance.GetEvent(this, receivedMessage);
                    break;

                case (byte)CommandClass.ManufacturerSpecific:
                    messageEvent = ManufacturerSpecific.GetEvent(this, receivedMessage);
                    if (messageEvent != null)
                    {
                        var specs = (ManufacturerSpecificInfo)messageEvent.Value;
                        this.ManufacturerId = specs.ManufacturerId;
                        this.TypeId         = specs.TypeId;
                        this.ProductId      = specs.ProductId;
                        if (ManufacturerSpecificResponse != null)
                        {
                            try
                            {
                                ManufacturerSpecificResponse(this, new ManufacturerSpecificResponseEventArg()
                                {
                                    NodeId = this.NodeId,
                                    ManufacturerSpecific = specs
                                });
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine("ZWaveLib: Error during ManufacturerSpecificResponse callback, " + ex.Message + "\n" + ex.StackTrace);
                            }
                        }
                    }

                    break;
                }
            }

            if (messageEvent != null)
            {
                this.RaiseUpdateParameterEvent(messageEvent.Instance, messageEvent.Event, messageEvent.Value);
            }
            else if (messageLength > 3)
            {
                if (receivedMessage[3] != 0x13)
                {
                    bool log = true;
                    if (messageLength > 7 && /* cmd_class */ receivedMessage[7] == (byte)CommandClass.ManufacturerSpecific)
                    {
                        log = false;
                    }
                    if (log)
                    {
                        Console.WriteLine("ZWaveLib UNHANDLED message: " + Utility.ByteArrayToString(receivedMessage));
                    }
                }
            }

            return(false);
        }
Esempio n. 16
0
 /// Constructor accepting delegate
 public CompiledCode(ScriptContext.ScriptExecuteMethod method)
 {
     Script = new UserCode(method);
 }
Esempio n. 17
0
        private void UpdateData()
        {
            List <int> ListDataIDs = GetDataIDs();

            for (int i = 0; i <= 9; i++)
            {
                string[] input     = new string[5];
                var      container = Master.FindControl("Body");

                for (int i2 = 0; i2 <= 3; i2++)
                {
                    string tbName = "tbEdit" + i.ToString() + i2.ToString();
                    var    txtBox = container.FindControl(tbName);

                    switch (i2)
                    {
                    case 0:
                        if (((TextBox)txtBox).Text != "")
                        {
                            input[i2] = _business.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        }
                        else
                        {
                            goto track1;
                        }
                        break;

                    case 1:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = 0.ToString();
                            ;
                        }
                        else
                        {
                            input[i2] = (((TextBox)txtBox).Text.ToString());
                        }
                        break;

                    case 2:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = DateTime.Today.ToString();
                        }
                        else
                        {
                            input[i2] = (((TextBox)txtBox).Text.ToString());
                        }
                        break;

                    case 3:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = DateTime.Today.ToString();
                        }
                        else
                        {
                            input[i2] = (((TextBox)txtBox).Text.ToString());
                        }
                        break;
                    }
                }


                string sortingPar = string.Format(" WHERE Contract_ID = {0}", GetDataIDs()[i]);
                List <ContractCode> CurrentContract = new List <ContractCode>();
                CurrentContract = _business.GetContracts(sortingPar);

                UserCode LoginUser = (UserCode)Session["authenticatedUser"];
                UserCode user      = GetCurrentUser(LoginUser.User_ID);

                DateTime dt      = DateTime.Now;
                string   dateNow = dt.ToString("yyyy-MM-dd");

                //projectID krijgen van de current row in de gridvieuw
                int    ProjectID     = CurrentContract[0].ProjectID;
                string ddNameProject = "ddEdit" + i.ToString() + 0.ToString();
                var    ddProject     = container.FindControl(ddNameProject) as DropDownList;

                //clientID krijgen van de current row in de gridvieuw
                int    ClientID     = CurrentContract[0].ClientID;
                string ddNameClient = "ddEdit" + i.ToString() + 1.ToString();
                var    ddClient     = container.FindControl(ddNameClient) as DropDownList;
                if (ddProject.SelectedValue.Count() < 1 || ddClient.SelectedValue.Count() < 1)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", "alert('Make sure you have selected a relation.')", true);
                }
                else
                {
                    _business.UpdateContract(ListDataIDs[i], input[0], Convert.ToDouble(input[1].TrimEnd('€')), Convert.ToDateTime(input[2]), Convert.ToDateTime(input[3]), Convert.ToInt32(ddProject.SelectedValue), Convert.ToInt32(ddClient.SelectedValue), user.User_ID.ToString(), dateNow);
                }
track1:
                continue;
            }
        }
Esempio n. 18
0
        private void OutputParameters_Load(object sender, EventArgs e)
        {
            try{
                switch (UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].FuncID)
                {
                case ProCodeCls.MainFunction.InputCameraInputFBD:
                    break;

                case ProCodeCls.MainFunction.CalibrationThresholdFBD:
                    break;

                case ProCodeCls.MainFunction.CalibrationBackgroundRemoveFBD:
                    break;

                case ProCodeCls.MainFunction.CalibrationMedianFilterFBD:
                    break;

                case ProCodeCls.MainFunction.CalibrationMorphologyProcessingFBD:
                    break;

                case ProCodeCls.MainFunction.MeasureBlobAnalysisFBD:
                {
                    showTempFlag = 0;

                    if (UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gBP.showOutputResultFlag[0])
                    {
                        checkListBoxOutputParameters.Items.Add(UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gBP.showOutputResultStr[0], true);
                    }
                    else
                    {
                        checkListBoxOutputParameters.Items.Add(UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gBP.showOutputResultStr[0], false);
                    }



                    showTempFlag = showTempFlag.TupleConcat(1);
                    if (UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gBP.showOutputResultFlag[1])
                    {
                        checkListBoxOutputParameters.Items.Add(UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gBP.showOutputResultStr[1], true);
                    }
                    else
                    {
                        checkListBoxOutputParameters.Items.Add(UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gBP.showOutputResultStr[1], false);
                    }



                    //checkListBoxOutputParameters.Items.Add(UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gBP.showOutputResultStr[0], true);
                    //checkListBoxOutputParameters.Items.Add(UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gBP.showOutputResultStr[1], true);

                    for (int i = 0; i < 34; i++)
                    {
                        if (UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gBP.outputIDIsChecked[i])
                        {
                            showTempFlag = showTempFlag.TupleConcat(i + 2);
                            if (UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gBP.showOutputResultFlag[i + 2])
                            {
                                checkListBoxOutputParameters.Items.Add(UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gBP.showOutputResultStr[i + 2], true);
                            }
                            else
                            {
                                checkListBoxOutputParameters.Items.Add(UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gBP.showOutputResultStr[i + 2], false);
                            }
                        }
                    }
                }
                break;

                case ProCodeCls.MainFunction.MeasureShapeSearchFBD:
                {
                    for (int i = 0; i < 5; i++)
                    {
                        if (UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gSSP.showOutputResultFlag[i])
                        {
                            checkListBoxOutputParameters.Items.Add(UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gSSP.showOutputResultStr[i], true);
                        }
                        else
                        {
                            checkListBoxOutputParameters.Items.Add(UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gSSP.showOutputResultStr[i], false);
                        }
                    }
                }
                break;

                case ProCodeCls.MainFunction.MeasureAnisoShapeSearchFBD:
                {
                    for (int i = 0; i < 7; i++)
                    {
                        if (UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gASSP.showOutputResultFlag[i])
                        {
                            checkListBoxOutputParameters.Items.Add(UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gASSP.showOutputResultStr[i], true);
                        }
                        else
                        {
                            checkListBoxOutputParameters.Items.Add(UserCode.GetInstance().gProCd[UserCode.GetInstance().showCurIdx].gASSP.showOutputResultStr[i], false);
                        }
                    }
                }
                break;

                default:
                    break;
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            //checkListBoxOutputParameters.SetItemChecked(0, Svision.GetMe().showImageResult);
            //checkListBoxOutputParameters.SetItemChecked(1, Svision.GetMe().showScore);
            //checkListBoxOutputParameters.SetItemChecked(2, Svision.GetMe().showPosition);
            //checkListBoxOutputParameters.SetItemChecked(3, Svision.GetMe().showAngle);
            //checkListBoxOutputParameters.SetItemChecked(4, Svision.GetMe().showTime);
            //checkListBoxOutputParameters.SetItemChecked(5, Svision.GetMe().showClass);
        }