Esempio n. 1
0
        private void btn_ConectaBD_Click(object sender, EventArgs e)
        {
            var    appSettings = ConfigurationSettings.AppSettings;
            string result      = appSettings["srcDB"] ?? "C:/SF/CardioSys/CardioSys.mdb";

            string mensaje = "";
            //public InfoDB(string src = "C:/CS/CardioSys.mdb", string user = "******", string pwd = "sfa080808528")
            //DBConnectClass db = new DBConnectClass("C:/CS/CardioSys.mdb", "sfa080808528");
            DBConnectClass db = new DBConnectClass(result, "sfa080808528");

            try
            {
                bool ok = db.Conecta(out mensaje);
                botonEstatus(ok);
            }
            catch (Exception ex)
            {
            }
            //MessageBox.Show(ok.ToString()+" /mensaje:\n"+mensaje, "Conexion", MessageBoxButtons.OK, MessageBoxIcon.Information);
            txt_respuesta.Text = "";
            txt_respuesta.Text = mensaje;
        }
    protected void yesDeleteASPxButton_Click(object sender, EventArgs e)
    {
        //replaySqlDataSource.InsertCommand = "Insert into tblmsgsyndicateReplay values(" + Session["ChassisID"] +
            //replaySqlDataSource.Insert();
            //try
            //{
            if (titleASPxTextBox.Text == string.Empty || ASPxHtmlEditor1.Html == null)
            {
                DisplayMessage("من فضلك قم بإدخال جميع البيانات المطلوبة المميزة بـ(*)", false);
                readMsgASPxPopupControl.ShowOnPageLoad = true;
            }
            else
            {

                //    readSqlDataSource.InsertCommand = "insert into tblmsgsyndicateReplay values(" + Convert.ToInt32(Session["msgid"]) + "," + Convert.ToInt32(Session["SyndicateID"]) + ",'" + DateTime.Now + "','" + sendMsgASPxMemo.Text + "')";
                //    readSqlDataSource.Insert();
                //    replayMsgASPxPopupControl.ShowOnPageLoad = false;
                //}catch{}
                //if (Request.QueryString["CourseId"] == null)
                //{
                //    DisplayMessage("من فضلك اختار دوره قبل الارسال", false);
                //    return;
                //},

                string strInsert = @"Insert into TBLFriendsArticles(ArticleTitle,UserName) values('" + titleASPxTextBox.Text +"','"+Session["UserName"]+ "')";
                DBConnectClass conn = new DBConnectClass("AriscFriend.mdb");
                OleDbCommand cmd = new OleDbCommand(strInsert, DBConnectClass.conn);

                //friendsSqlDataSource.InsertCommand = "";
                //friendsSqlDataSource.InsertCommand = strInsert;
                //friendsSqlDataSource.Insert();
                cmd.ExecuteNonQuery();
                OleDbDataAdapter da = new OleDbDataAdapter("select max(ArticleID) from TBLFriendsArticles", DBConnectClass.conn);

                DataTable dt=new DataTable();
                da.Fill(dt);
                int id = Convert.ToInt32(dt.Rows[0][0]);

                string detailsFile = Server.MapPath("ArticleFiles\\" + id);

                File.WriteAllText(detailsFile, ASPxHtmlEditor1.Html);
                DSCdArticles.UpdateCommand = "update TBLFriendsArticles set ArticleDetailsFile='" + detailsFile + "' where ArticleID=" + id;
                DSCdArticles.Update();
                //if (ResultMsg != string.Empty)
                //{

                    DisplayMessage("تم الحفظ بنجاح", false);
                    readMsgASPxPopupControl.ShowOnPageLoad=true;
                    //RBtnClear_Click(RBtnClear, new EventArgs());
                //}
                //else
                //    DisplayMessage(ResultMsg, false);
            }
    }
    protected void yesDeleteASPxButton_Click(object sender, EventArgs e)
    {
        //replaySqlDataSource.InsertCommand = "Insert into tblmsgsyndicateReplay values(" + Session["ChassisID"] +
            //replaySqlDataSource.Insert();
            //try
            //{
            if (RTxtTraineeName.Text == string.Empty || RTxtNameInEnglish.Text == string.Empty ||
            RCBCityId.Value == null ||
            passwordASPxTextBox.Text == string.Empty ||
            fieldRTxt.Text == string.Empty ||
            phoneASPxTextBox.Text == string.Empty ||
            genderASPxRadioButtonList.Value  == null ||
            jobRTxt.Text==string.Empty ||
            emailASPxTextBox.Text == string.Empty||
                EventImageTextBox.Text==string.Empty)
            {
                DisplayMessage("من فضلك قم بإدخال جميع البيانات المطلوبة المميزة بـ(*)", false);
                readMsgASPxPopupControl.ShowOnPageLoad = true;
            }
            else
            {

                //    readSqlDataSource.InsertCommand = "insert into tblmsgsyndicateReplay values(" + Convert.ToInt32(Session["msgid"]) + "," + Convert.ToInt32(Session["SyndicateID"]) + ",'" + DateTime.Now + "','" + sendMsgASPxMemo.Text + "')";
                //    readSqlDataSource.Insert();
                //    replayMsgASPxPopupControl.ShowOnPageLoad = false;
                //}catch{}
                //if (Request.QueryString["CourseId"] == null)
                //{
                //    DisplayMessage("من فضلك اختار دوره قبل الارسال", false);
                //    return;
                //}

                string strInsert = @"update TBLFriends set FriendArabicName='" + RTxtTraineeName.Text + "',FriendEnglishName='" + RTxtNameInEnglish.Text + "',GenderID=" + genderASPxRadioButtonList.Value + ",Mobile='" + phoneASPxTextBox.Text + "',Email='" + emailASPxTextBox.Text + "',FacebookEmail='" + facebookASPxTextBox.Text + "',City=" + RCBCityId.Value + ",FieldText='" + fieldRTxt.Text + "',JobName='" + jobRTxt.Text + "',Pass='******',Photo='" + EventImageTextBox.Text + "' where FriendID=" + ViewState["fid"];
                DBConnectClass conn = new DBConnectClass("AriscFriend.mdb");
                OleDbCommand cmd = new OleDbCommand(strInsert, DBConnectClass.conn);

                //friendsSqlDataSource.InsertCommand = "";
                //friendsSqlDataSource.InsertCommand = strInsert;
                //friendsSqlDataSource.Insert();
                cmd.ExecuteNonQuery();

                string user = Session["UserName"].ToString();
                string pass = passwordASPxTextBox.Text;
                string mail = emailASPxTextBox.Text ;

                //if (ResultMsg != string.Empty)
                //{

                    SendMail(user,pass,mail);
                    DisplayMessage("تم الحفظ بنجاح و تم إرسال رسالة لكم بمعلومات الدخول على بريدكم الالكتروني", false);
                    readMsgASPxPopupControl.ShowOnPageLoad=true;
                    //RBtnClear_Click(RBtnClear, new EventArgs());
                //}
                //else
                //    DisplayMessage(ResultMsg, false);
            }
    }