Пример #1
0
        private bool fSaveData(bool pMessage)
        {
            bool   vIsSaved     = false;
            long   rowsAffected = 0;
            string vGender      = "";

            try
            {
                if (pMessage == true)
                {
                    if (MessageBox.Show("هل تريد الحفظ ؟", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign) == System.Windows.Forms.DialogResult.Yes)
                    {
                        if (fValidateQuestion() == false)
                        {
                            return(false);
                        }
                        else
                        {
                            sSave();
                            rowsAffected = BasicClass.fDMLData(vSqlStatment, "FRM_Questions");
                            if (rowsAffected > 0)
                            {
                                if (Strings.Trim(this.OpnDlg_Picture.FileName).Length > 0)
                                {
                                    rowsAffected += BasicClass.fAttachImage(Strings.Trim(this.OpnDlg_Picture.FileName), "[Question]", "Picture", " Where Code           ='" + Strings.Trim(vQuestionCode) + "'", this.Name);
                                    this.OpnDlg_Picture.FileName = null;
                                }
                                vIsSaved = true;
                                sNew();
                                sResetFormMode();
                            }
                        }
                    }
                }
                else
                {
                    if (fValidateQuestion() == false)
                    {
                        return(false);
                    }
                    else
                    {
                        sSave();
                        rowsAffected = BasicClass.fDMLData(vSqlStatment, "FRM_Questions");
                        if (rowsAffected > 0)
                        {
                            vIsSaved = true;
                            sNew();
                            sResetFormMode();
                        }
                    }
                }
                sEmptySqlStatmentArray();
            }
            catch (Exception Ex)
            {
                ExceptionHandler.HandleException(Ex.Message, "FRM_Questions", "fSaveData");
            }
            return(vIsSaved);
        }