Beispiel #1
0
        public virtual async Task <DTO.Comment> GetCommentByIdAndShop(int id, int?shopId)
        {
            var res = await RepositoryDbSet
                      .Include(a => a.CommentTitle).ThenInclude(t => t.Translations)
                      .Include(a => a.CommentBody).ThenInclude(t => t.Translations)
                      .Include(a => a.Product).ThenInclude(aa => aa.ProductName).ThenInclude(t => t.Translations)
                      .Where(s => s.Id == id && s.ShopId == shopId)
                      .Select(c => new
            {
                Id                       = c.Id,
                CommentTitle             = c.CommentTitle,
                CommentBody              = c.CommentBody,
                ProductName              = c.Product.ProductName,
                ProductId                = c.ProductId,
                ShopId                   = c.ShopId,
                CommentBodyTranslations  = c.CommentBody.Translations,
                CommentTitleTranslations = c.CommentTitle.Translations,
                ProductNameTranslations  = c.Product.ProductName.Translations
            }).FirstOrDefaultAsync();

            var result = new DTO.Comment()
            {
                Id           = res.Id,
                CommentTitle = res.CommentTitle.Translate(),
                CommentBody  = res.CommentBody.Translate(),
                ProductName  = res.ProductName.Translate(),
                ProductId    = res.ProductId,
                ShopId       = res.ShopId
            };

            return(result);
        }
Beispiel #2
0
 public DTO.Comment SetValue()
 {
     Ob              = new DTO.Comment();
     Ob.CommentName  = txtComment.Text.ToUpper();
     Ob.Active       = 1;
     Ob.DateModified = Globals.date[0].ToString();
     Ob.CommentID    = lblUpdateId.Text;
     Ob.BranchId     = Globals.BranchID;
     return(Ob);
 }
Beispiel #3
0
 public void setDefault()
 {
     btnSave.Visible = true;
     btnEdit.Visible = false;
     txtComment.Focus();
     txtComment.Text = "";
     Ob = SetValue();
     grdComment.DataSource = BAL.BALFactory.Instance.BAL_Comment.ShowAll(Ob);
     grdComment.DataBind();
 }
Beispiel #4
0
        public DataSet ShowAll(DTO.Comment Ob)
        {
            SqlCommand cmd = new SqlCommand();
            DataSet    ds  = new DataSet();

            cmd.CommandText = "sp_CommentMaster";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@BranchId", Ob.BranchId);
            cmd.Parameters.AddWithValue("@Flag", 3);
            ds = PrjClass.GetData(cmd);
            return(ds);
        }
Beispiel #5
0
        public string DeleteComment(DTO.Comment Ob)
        {
            SqlCommand cmd = new SqlCommand();
            string     res = string.Empty;

            cmd.CommandText = "sp_CommentMaster";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@CommentID", Ob.CommentID);
            cmd.Parameters.AddWithValue("@BranchId", Ob.BranchId);
            cmd.Parameters.AddWithValue("@Flag", 5);
            res = PrjClass.ExecuteNonQuery(cmd);
            return(res);
        }
Beispiel #6
0
        public string SaveCommentMaster(DTO.Comment Ob)
        {
            string     res = string.Empty;
            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = "sp_CommentMaster";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@CommentName", Ob.CommentName);
            cmd.Parameters.AddWithValue("@Active", Ob.Active);
            cmd.Parameters.AddWithValue("@BranchId", Ob.BranchId);
            cmd.Parameters.AddWithValue("@Flag", 1);
            res = PrjClass.ExecuteNonQuery(cmd);
            return(res);
        }
Beispiel #7
0
        public static Model.Comment TranslateDTOCommentToModelComment(DTO.Comment c)
        {
            if (c == null)
            {
                return(null);
            }

            return(new Model.Comment
            {
                Id = c.Id,
                LastModified = c.LastModified,
                LastModifiedByUser = UserMapper.TranslateDTOUserToModelUser(c.LastModifiedByUser),
                Text = c.Text
            });
        }
Beispiel #8
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            string res = "";

            Ob  = SetValue();
            res = BAL.BALFactory.Instance.BAL_Comment.UpdateCommentMaster(Ob);
            if (res == "Record Saved")
            {
                lblMsg.Text = res;
                setDefault();
            }
            else
            {
                lblErr.Text = res;
            }
        }
Beispiel #9
0
 public string SaveCommentMaster(DTO.Comment Ob)
 {
     return(DAL.DALFactory.Instance.DAL_Comment.SaveCommentMaster(Ob));
 }
Beispiel #10
0
 public string DeleteComment(DTO.Comment Ob)
 {
     return(DAL.DALFactory.Instance.DAL_Comment.DeleteComment(Ob));
 }
Beispiel #11
0
 public DataSet ShowAll(DTO.Comment Ob)
 {
     return(DAL.DALFactory.Instance.DAL_Comment.ShowAll(Ob));
 }
Beispiel #12
0
 public DataSet BindGridView(DTO.Comment Ob)
 {
     return(DAL.DALFactory.Instance.DAL_Comment.BindGridView(Ob));
 }
Beispiel #13
0
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     Ob = SetValue();
     grdComment.DataSource = BAL.BALFactory.Instance.BAL_Comment.BindGridView(Ob);
     grdComment.DataBind();
 }