Exemplo n.º 1
0
        void btnSend_Click(object sender, EventArgs e)
        {
            try
            {
                Fatawa _fatwa = new Fatawa();
                int? id = 0;
                _fatwa.Address = "";
                _fatwa.Answer = "";
                _fatwa.AnswerDate = DateTime.Now.ToString("dd/MM/yyyy");
                //_fatwa.AnsweredBy = SecurityContext.LoggedInUser.ID.ToString();
                _fatwa.AnsweredBy = "";
                _fatwa.Email = txtEmail.Text;
                _fatwa.IsDeleted = false;
                _fatwa.Mobile = "";
                _fatwa.Name = txtName.Text;
                _fatwa.Question = txtQuestion.Text;
                _fatwa.QuestionDate = DateTime.Now.ToString("dd/MM/yyyy");
                _fatwa.CategoryID = 0;

                _fatwa.Status = 1;
                FatawaManager.Add(_fatwa);
                dvMessages.InnerText = Resources.ExpressCMS.YourFatwaHadbeenSend;

                AddEmailtoQueue(txtEmail.Text, txtName.Text);
            }
            catch (Exception ex)
            {
                dvMessages.InnerText = ex.Message;
            }

        }
Exemplo n.º 2
0
        public static void Update(Fatawa obj)
        {
            FatawaDataMapper objCaller = new FatawaDataMapper();

            objCaller.Update(obj);
        }
Exemplo n.º 3
0
 public void PopulateFatawa(SqlDataReader _dtr, Fatawa obj)
 {
     int columnIndex = 0;
     columnIndex = _dtr.GetOrdinal(FatawaDataMapper.CN_ID);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.ID = _dtr.GetInt32((columnIndex));
     }
     columnIndex = _dtr.GetOrdinal(FatawaDataMapper.CN_NAME);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.Name = _dtr.GetString((columnIndex));
     }
     columnIndex = _dtr.GetOrdinal(FatawaDataMapper.CN_EMAIL);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.Email = _dtr.GetString((columnIndex));
     }
     columnIndex = _dtr.GetOrdinal(FatawaDataMapper.CN_MOBILE);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.Mobile = _dtr.GetString((columnIndex));
     }
     columnIndex = _dtr.GetOrdinal(FatawaDataMapper.CN_ADDRESS);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.Address = _dtr.GetString((columnIndex));
     }
     columnIndex = _dtr.GetOrdinal(FatawaDataMapper.CN_QUESTION);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.Question = _dtr.GetString((columnIndex));
     }
     columnIndex = _dtr.GetOrdinal(FatawaDataMapper.CN_ANSWER);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.Answer = _dtr.GetString((columnIndex));
     }
     columnIndex = _dtr.GetOrdinal(FatawaDataMapper.CN_ANSWEREDBY);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.AnsweredBy = _dtr.GetString((columnIndex));
     }
     columnIndex = _dtr.GetOrdinal(FatawaDataMapper.CN_QUESTIONDATE);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.QuestionDate = _dtr.GetString((columnIndex));
     }
     columnIndex = _dtr.GetOrdinal(FatawaDataMapper.CN_ANSWERDATE);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.AnswerDate = _dtr.GetString((columnIndex));
     }
     columnIndex = _dtr.GetOrdinal(FatawaDataMapper.CN_STATUS);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.Status = _dtr.GetInt32((columnIndex));
     }
     columnIndex = _dtr.GetOrdinal(FatawaDataMapper.CN_ISDELETED);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.IsDeleted = _dtr.GetBoolean((columnIndex));
     }
     columnIndex = _dtr.GetOrdinal(FatawaDataMapper.CN_CATEGORY_ID);
     if (!_dtr.IsDBNull(columnIndex))
     {
         obj.CategoryID = _dtr.GetInt32((columnIndex));
     }
 }
Exemplo n.º 4
0
        public static int Add(Fatawa obj)
        {
            FatawaDataMapper objCaller = new FatawaDataMapper();

            return objCaller.Add(obj);
        }
Exemplo n.º 5
0
        void btnSaveUpdate_Click(object sender, EventArgs e)
        {
            if (NoBot2.IsValid())
            {

                if (cu.Checked)
                {

                    string result = string.Empty;
                    InQuiry _quiry = new InQuiry();
                    _quiry.Country = HttpUtility.HtmlEncode(txtCountry.Text);
                    _quiry.Email = HttpUtility.HtmlEncode(txtEmail.Text);
                    _quiry.Description = HttpUtility.HtmlEncode(txtDescription.Text);
                    _quiry.Name = HttpUtility.HtmlEncode(txtName.Text);
                    _quiry.Phone = HttpUtility.HtmlEncode(txtPhone.Text);
                    _quiry.IsDeleted = false;
                    _quiry.Status = DataLayer.Enums.RootEnums.InQuiryStatus.Pending;

                    InQuiryManager.Add(_quiry);
                    ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString().Substring(0, 4), "alert('" + Resources.ExpressCMS.SuccessfullySent + "');", true);
                    if (_quiry.ID > 0)
                        dvMessage.InnerText = Resources.ExpressCMS.ResourceManager.GetString("SuccessfullySent");
                    else
                        dvMessage.InnerText = Resources.ExpressCMS.ResourceManager.GetString("FormSubmitFailed");
                }
                else
                    if (fa.Checked)
                    {
                        try
                        {
                            Fatawa _fatwa = new Fatawa();
                            int? id = 0;
                            _fatwa.Address = "";
                            _fatwa.Answer = "";
                            _fatwa.AnswerDate = DateTime.Now.ToShortDateString();
                            //_fatwa.AnsweredBy = SecurityContext.LoggedInUser.ID.ToString();
                            _fatwa.AnsweredBy = "";
                            _fatwa.Email = txtEmail.Text;
                            _fatwa.IsDeleted = false;
                            _fatwa.Mobile = "";
                            _fatwa.Name = txtName.Text;
                            _fatwa.Question = txtDescription.Text;
                            _fatwa.QuestionDate = DateTime.Now.ToString("dd/MM/yyyy");
                            _fatwa.CategoryID = -1;

                            _fatwa.Status = 0;
                            FatawaManager.Add(_fatwa);
                            AddEmailtoQueue(txtEmail.Text, txtName.Text);

                            dvMessage.InnerText = Resources.ExpressCMS.YourFatwaHadbeenSend;
                            ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString().Substring(0, 4), "alert('" + Resources.ExpressCMS.YourFatwaHadbeenSend + "');", true);
                        }
                        catch (Exception ex)
                        {
                            dvMessage.InnerText = ex.Message;
                        }

                    }
                ScriptManager.RegisterStartupScript(upnall, upnall.GetType(), Guid.NewGuid().ToString().Substring(0, 6), "alert('" + dvMessage.InnerText + "');", true);

                AddMode();
            }
        }
Exemplo n.º 6
0
        void btnSaveUpdate_Click(object sender, EventArgs e)
        {
            if (ObjectID <= 0)
            {
                try
                {
                    Fatawa _fatwa = new Fatawa();

                    _fatwa.Address = "";
                    _fatwa.Answer = txtAnswer.Text;
                    _fatwa.AnswerDate = DateTime.Now.ToString("dd/MM/yyyy");
                    _fatwa.AnsweredBy = SecurityContext.LoggedInUser.Name;
                    _fatwa.CategoryID = Convert.ToInt32(ddlCategories.SelectedValue);
                    _fatwa.Email = txtEmail.Text;
                    _fatwa.QuestionDate = DateTime.Now.ToString("dd/MM/yyyy");

                    _fatwa.IsDeleted = false;
                    _fatwa.Mobile = "";
                    _fatwa.Name = txtName.Text;
                    _fatwa.Question = txtQuestion.Text;
                    _fatwa.Status = 1;
                    FatawaManager.Add(_fatwa);
                    AddMode();
                    ScriptManager.RegisterStartupScript(upnall, upnall.GetType(), Guid.NewGuid().ToString().Substring(0, 8), "alert('Saved Successfully');", true);
                }
                catch (Exception ex)
                {
                    dvProblems.InnerText = ex.ToString();
                }
            }
            else
            {
                try
                {
                    Fatawa _fatwa = new Fatawa();
                    _fatwa = FatawaManager.GetByID(ObjectID);
                    if (null == _fatwa)
                    {
                        dvProblems.InnerText = Resources.ExpressCMS.ResourceManager.GetString(ConstantsManager.UnknowErronOccures);
                        return;
                    }
                    _fatwa.Address = "";
                    _fatwa.Answer = txtAnswer.Text;
                    _fatwa.AnswerDate = DateTime.Now.ToString("dd/MM/yyyy");
                    _fatwa.AnsweredBy = SecurityContext.LoggedInUser.Name;
                    _fatwa.CategoryID = Convert.ToInt32(ddlCategories.SelectedValue);
                    _fatwa.Email = txtEmail.Text;
                    _fatwa.IsDeleted = false;
                    _fatwa.Mobile = "";
                    _fatwa.Name = txtName.Text;
                    _fatwa.Question = txtQuestion.Text;
                    _fatwa.Status = Convert.ToInt32(ddlStatus.SelectedValue);
                    FatawaManager.Update(_fatwa);
                    EditMode();
                    if (_fatwa.Status == Convert.ToInt32(RootEnums.FatawaStatus.Resolved))
                    {
                        AddEmailtoQueue(_fatwa.Email, _fatwa.Name, _fatwa.Question, _fatwa.Answer);
                    }
                    ScriptManager.RegisterStartupScript(upnall, upnall.GetType(), Guid.NewGuid().ToString().Substring(0, 8), "alert('Saved Successfully');", true);
                }
                catch (Exception ex)
                {
                    dvProblems.InnerText = ex.ToString();
                }
            }

        }
Exemplo n.º 7
0
 public Fatawa GetFatawa(SqlDataReader _dtr, IList<Fatawa> colobj)
 {
     Fatawa obj = colobj.Where(t => t.ID == Convert.ToInt32(_dtr[CN_ID].ToString())).SingleOrDefault();
     if (null == obj)
     {
         obj = new Fatawa();
         colobj.Add(obj);
     }
     return obj;
 }
Exemplo n.º 8
0
        public int Add(Fatawa obj)
        {
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = INSERTFatawa;

            #region [Parameters]
            SqlParameter parameterID = new SqlParameter(PN_ID, SqlDbType.Int);
            parameterID.Value = obj.ID;
            parameterID.Direction = ParameterDirection.Output;
            _command.Parameters.Add(parameterID);
            SqlParameter parameterName = new SqlParameter(PN_NAME, SqlDbType.NVarChar);
            parameterName.Value = obj.Name;
            parameterName.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterName);
            SqlParameter parameterEmail = new SqlParameter(PN_EMAIL, SqlDbType.NVarChar);
            parameterEmail.Value = obj.Email;
            parameterEmail.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterEmail);
            SqlParameter parameterMobile = new SqlParameter(PN_MOBILE, SqlDbType.NVarChar);
            parameterMobile.Value = obj.Mobile;
            parameterMobile.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterMobile);
            SqlParameter parameterAddress = new SqlParameter(PN_ADDRESS, SqlDbType.NVarChar);
            parameterAddress.Value = obj.Address;
            parameterAddress.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterAddress);
            SqlParameter parameterQuestion = new SqlParameter(PN_QUESTION, SqlDbType.NVarChar);
            parameterQuestion.Value = obj.Question;
            parameterQuestion.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterQuestion);
            SqlParameter parameterAnswer = new SqlParameter(PN_ANSWER, SqlDbType.NVarChar);
            parameterAnswer.Value = obj.Answer;
            parameterAnswer.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterAnswer);
            SqlParameter parameterAnsweredBy = new SqlParameter(PN_ANSWEREDBY, SqlDbType.NVarChar);
            parameterAnsweredBy.Value = obj.AnsweredBy;
            parameterAnsweredBy.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterAnsweredBy);
            SqlParameter parameterQuestionDate = new SqlParameter(PN_QUESTIONDATE, SqlDbType.NVarChar);
            parameterQuestionDate.Value = obj.QuestionDate;
            parameterQuestionDate.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterQuestionDate);
            SqlParameter parameterAnswerDate = new SqlParameter(PN_ANSWERDATE, SqlDbType.NVarChar);
            parameterAnswerDate.Value = obj.AnswerDate;
            parameterAnswerDate.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterAnswerDate);
            SqlParameter parameterStatus = new SqlParameter(PN_STATUS, SqlDbType.Int);
            parameterStatus.Value = obj.Status;
            parameterStatus.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterStatus);
            SqlParameter parameterIsDeleted = new SqlParameter(PN_ISDELETED, SqlDbType.Bit);
            parameterIsDeleted.Value = obj.IsDeleted;
            parameterIsDeleted.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterIsDeleted);

            SqlParameter paramCategoryID = new SqlParameter(PN_CATEGORY_ID, SqlDbType.Int);
            paramCategoryID.Value = obj.CategoryID;
            paramCategoryID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(paramCategoryID);
            #endregion;

            _connection.Open();
            _command.ExecuteNonQuery();
            _connection.Close();
            obj.ID = Convert.ToInt32(parameterID.Value);
            return obj.ID;
        }
Exemplo n.º 9
0
        public IList<Fatawa> GetAllByCategoryByPaging(int catid, int from, int to, ref int totalrows, int status, string keyword)
        {

            Fatawa obj = null;

            IList<Fatawa> colobj = new List<Fatawa>();
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = "FatawaGetAllByCategoryPaging";

            SqlParameter paramCategoryID = new SqlParameter(PN_CATEGORY_ID, SqlDbType.Int);
            paramCategoryID.Value = catid;
            paramCategoryID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(paramCategoryID);

            SqlParameter pTotalRows = new SqlParameter("TotalRows", SqlDbType.Int);
            pTotalRows.Value = totalrows;
            pTotalRows.Direction = ParameterDirection.Output;
            _command.Parameters.Add(pTotalRows);

            SqlParameter pFrom = new SqlParameter("From", SqlDbType.Int);
            pFrom.Value = from;
            pFrom.Direction = ParameterDirection.Input;
            _command.Parameters.Add(pFrom);

            SqlParameter pTo = new SqlParameter("To", SqlDbType.Int);
            pTo.Value = to;
            pTo.Direction = ParameterDirection.Input;
            _command.Parameters.Add(pTo);

            SqlParameter Pstatus = new SqlParameter("STATUS", SqlDbType.Int);
            Pstatus.Value = status;
            Pstatus.Direction = ParameterDirection.Input;
            _command.Parameters.Add(Pstatus);

            SqlParameter pKeyword = new SqlParameter("@Keyword", SqlDbType.NVarChar);
            pKeyword.Value = keyword;
            pKeyword.Direction = ParameterDirection.Input;
            _command.Parameters.Add(pKeyword);

            _connection.Open();
            try
            {
                using (_dtreader = _command.ExecuteReader())
                {
                    if (_dtreader != null && _dtreader.HasRows)
                    {
                        obj = new Fatawa();
                        colobj = new List<Fatawa>();
                        while (_dtreader.Read())
                        {
                            obj = GetFatawa(_dtreader, colobj);
                            GetEntityFromReader(_dtreader, obj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                totalrows = Convert.ToInt32(pTotalRows.Value);
                _dtreader.Close();
                _connection.Close();
            }

            return colobj;
        }
Exemplo n.º 10
0
        public IList<Fatawa> GetAll()
        {

            Fatawa obj = null;

            IList<Fatawa> colobj = null;
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = FatawaGetAll;

            _connection.Open();
            try
            {
                using (_dtreader = _command.ExecuteReader())
                {
                    if (_dtreader != null && _dtreader.HasRows)
                    {
                        obj = new Fatawa();
                        colobj = new List<Fatawa>();
                        while (_dtreader.Read())
                        {
                            obj = GetFatawa(_dtreader, colobj);
                            GetEntityFromReader(_dtreader, obj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

                _dtreader.Close();
                _connection.Close();
            }

            return colobj;
        }
Exemplo n.º 11
0
 private void GetEntityFromReader(SqlDataReader _dtr, Fatawa obj)
 {
     PopulateFatawa(_dtr, obj);
 }
Exemplo n.º 12
0
        public IList<Fatawa> Search(string keyword, int catid)
        {
            Fatawa obj = null;

            IList<Fatawa> colobj = new List<Fatawa>();
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = "[FatawaSearch]";


            #region [Parameters]
            SqlParameter paramkeyword = new SqlParameter("KEYWORD", SqlDbType.NVarChar);
            paramkeyword.Value = keyword;
            paramkeyword.Direction = ParameterDirection.Input;
            _command.Parameters.Add(paramkeyword);

            SqlParameter paramcatid = new SqlParameter(PN_CATEGORY_ID, SqlDbType.Int);
            paramcatid.Value = catid;
            paramcatid.Direction = ParameterDirection.Input;
            _command.Parameters.Add(paramcatid);
            #endregion;

            _connection.Open();
            try
            {
                using (_dtreader = _command.ExecuteReader())
                {
                    if (_dtreader != null && _dtreader.HasRows)
                    {
                        obj = new Fatawa();
                        colobj = new List<Fatawa>();
                        while (_dtreader.Read())
                        {
                            obj = GetFatawa(_dtreader, colobj);
                            GetEntityFromReader(_dtreader, obj);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

                _dtreader.Close();
                _connection.Close();
            }

            return colobj;
        }
Exemplo n.º 13
0
        public Fatawa GetByID(int ID)
        {

            Fatawa obj = null;
            _connection.ConnectionString = _ConnectionString;
            _command.Connection = _connection;
            _command.CommandType = CommandType.StoredProcedure;
            _command.CommandText = SELECTFatawa;

            #region [Parameters]
            SqlParameter parameterID = new SqlParameter(PN_ID, SqlDbType.Int);
            parameterID.Value = ID;
            parameterID.Direction = ParameterDirection.Input;
            _command.Parameters.Add(parameterID);
            #endregion;

            _connection.Open();
            try
            {
                using (_dtreader = _command.ExecuteReader())
                {
                    if (_dtreader != null && _dtreader.HasRows)
                    {
                        obj = new Fatawa();
                        if (_dtreader.Read())
                            GetEntityFromReader(_dtreader, obj);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

                _dtreader.Close();
                _connection.Close();
            }

            return obj;
        }