Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            gvAnswers.UpdateCurrentRow();
            gvOpenEndedCode.UpdateCurrentRow();
            gvSkipLogic.UpdateCurrentRow();
            QuestionID = QuestionID == null?QAFunction.NewGuid() : QuestionID;

            var IsRevivewCode = (gvOpenEndedCode.DataRowCount == 0) ? 0 : 1;
            var query         = DataAccess.DataQuery.Create("Docs", "ws_DOC_GenericFormQuestion_Save", new
            {
                QuestionID   = QuestionID,
                QuestionCode = txtQuestionCode.Text.Trim().ToUpper(),
                QuestionName,
                ValueType        = radioGroup1.EditValue,
                ValueRangeNumber = (gAnswers.DataSource as DataTable).DataTableToJSON(),
                SkipLogic        = (gSkipLogic.DataSource as DataTable).DataTableToJSON(),
                OpenEndedRecode  = (gOpenEndedCode.DataSource as DataTable).GetJSONString(),
                ProjectID,
                IsRequired     = checkEdit1.Checked,
                IsMainRotation = 0,
                IsSubRotation  = 0,
                IsRevivewCode  = IsRevivewCode
            });
            var ds = Services.Execute(query);

            if (ds == null)
            {
                UI.ShowError(Services.LastError);
                return;
            }
            UI.InformationSaved();
            DialogResult = DialogResult.OK;
        }
        private void btnAddMultiChoice_Click(object sender, EventArgs e)
        {
            using (var frm = new DesignForm.frmDesignMultiChoiceControl())
            {
                frm.Initialize(Services);

                frm.View_Question_QuestionName          = "Enter your question!";
                frm.MultiChoice_Variables_VariablesName = "Q_" + (gvQuestions.DataRowCount + 1).ToString();
                frm.MultiChoice_Answer_AnswerList       = "";
                frm.QuestionIndex  = gvQuestions.DataRowCount + 1;
                frm.ProjectID      = this.ProjectID;
                frm.QuestionID     = QAFunction.NewGuid();
                frm.QuestionTypeID = "79A06333-E2F1-4A3C-B576-F7235BAD1577";
                frm.Process();
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    Process();
                    gvQuestions.SelectARowInGridView("QuestionID", frm.QuestionID);
                }
            }
        }
Esempio n. 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var query = DataAccess.DataQuery.Create("Docs", "ws_L_Project_Save", new
            {
                ProjectID = ProjectID == null ? QAFunction.NewGuid() : ProjectID,
                ProjectNo,
                ProjectName,
                ProjectDesciption,
                ProjectIsActived,
                ProjectTypeID = cbProjectType.SelectedValue == null ? "" : cbProjectType.SelectedValue,
                UserID        = Services.GetInformation("UserID")
            });
            var ds = Services.Execute(query);

            if (ds == null)
            {
                UI.ShowError(Services.LastError);
                return;
            }
            UI.InformationSaved();
            DialogResult = DialogResult.OK;
        }
        private void cmdContinue_Click(object sender, EventArgs e)
        {
            if (ValidateForm() == false)
            {
                return;
            }

            var username = txtUserName.Text.Trim();
            var password = txtPassword.Text.Trim().GetMd5Hash();

            var query = DataQuery.Create("Security", "ws_Session_Authenticate", new { Username = username, PasswordHash = password, FacID = QAFunction.GetFacID(Services) });
            var ds    = Services.Execute(query);

            if (ds == null)
            {
                MessageBox.Show(Services.LastError);
                return;
            }

            Services.SetInformation("UserID", ds.FirstRow().Item("UserID"));
            Services.SetInformation("Username", ds.FirstRow().Item("Username"));
            Services.SetInformation("SessionID", ds.FirstRow().Item("SessionID"));
            UserID   = ds.FirstRow().Item("UserID");
            UserName = ds.FirstRow().Item("Username");

            //var UserID = Services.GetInformation("UserID");

            var result = ds.FirstValue() + "";

            if (result.ToUpper() != "OK")
            {
                // Xóa Session khia user logout hoac tat phan mem.
                query = DataQuery.Create("Security", "ws_Session_Delete");

                ds = Services.Execute(query);

                if (ds == null)
                {
                    MessageBox.Show(Services.LastError);
                    return;
                }

                MessageBox.Show(this, result, Services.Localize("Login", "ErrorCaption"), MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
        //private string Reload;

        public override void Process()
        {
            this.Text = QAFunction.ReadFromConfigXMlFile("ApplicationName");
            LoadMenu();
        }