Ejemplo n.º 1
1
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["status"] == "1")
        {
            MarkTransferEntity od = MarkTransferManager.CreateInstant().GetByCode(Request["ordercode"]);
            if (od != null)
            {
                Session["PAY"] = true;

                // chi tiet nop tien
                MarkAddHistoryEntity hisobj = new MarkAddHistoryEntity();

                // kt user da ton tai trong bang customer chua
                CustomersEntity CusObj = new CustomersEntity();
                CustomersEntity CusTemp = CustomersManager.CreateInstant().GetByName(Util.CurrentUserName);
                if (CusTemp != null) //kt user da ton tai trong bang customer chua
                {
                    hisobj.MarkBeforeAdd = CusTemp.Mark;

                    CusObj = CusTemp;
                    CusObj.Mark = CusObj.Mark + od.Mark;
                    CustomersManager.CreateInstant().Update(CusObj);
                }
                else
                {
                    hisobj.MarkBeforeAdd = 0;

                    CusObj.Id = Guid.NewGuid();
                    CusObj.UserName = Util.CurrentUserName;
                    CusObj.FullName = Profile.FullName;
                    CusObj.Mark = od.Mark;
                    CustomersManager.CreateInstant().Insert(CusObj);
                }
                hisobj.Id = Guid.NewGuid();
                hisobj.CustomerId = CusObj.Id;
                hisobj.CodeMarkId = Guid.Empty;
                hisobj.Date = DateTime.Now;
                hisobj.MarkAfterAdd = CusObj.Mark;
                hisobj.CreatedBy = Util.CurrentUserName;
                hisobj.CreatedDate = DateTime.Now;
                hisobj.IsDeleted = false;
                MarkAddHistoryManager.CreateInstant().Insert(hisobj);

                Response.Redirect("/Payment/Thankyou.aspx?t=" + NganLuong.PayDoc + "&id=" + od.Id.ToString());
            }
        }
        Response.Redirect("/");
    }
Ejemplo n.º 2
0
 public bool Delete(Guid Id)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         MarkAddHistoryEntity _MarkAddHistoryEntity = new MarkAddHistoryEntity(Id);
         if (adapter.FetchEntity(_MarkAddHistoryEntity))
         {
             adapter.DeleteEntity(_MarkAddHistoryEntity);
             toReturn = true;
         }
     }
     return toReturn;
 }
Ejemplo n.º 3
0
 public MarkAddHistoryEntity Insert(MarkAddHistoryEntity _MarkAddHistoryEntity)
 {
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.SaveEntity(_MarkAddHistoryEntity, true);
     }
     return _MarkAddHistoryEntity;
 }
Ejemplo n.º 4
0
        public MarkAddHistoryEntity Insert(Guid CustomerId, Guid CodeMarkId, DateTime Date, long MarkBeforeAdd, long MarkAfterAdd, DateTime CreatedDate, string CreatedBy, DateTime UpdatedDate, string UpdatedBy, bool IsDeleted)
        {
            MarkAddHistoryEntity _MarkAddHistoryEntity = new MarkAddHistoryEntity();
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {

                _MarkAddHistoryEntity.CustomerId = CustomerId;
                _MarkAddHistoryEntity.CodeMarkId = CodeMarkId;
                _MarkAddHistoryEntity.Date = Date;
                _MarkAddHistoryEntity.MarkBeforeAdd = MarkBeforeAdd;
                _MarkAddHistoryEntity.MarkAfterAdd = MarkAfterAdd;
                _MarkAddHistoryEntity.CreatedDate = CreatedDate;
                _MarkAddHistoryEntity.CreatedBy = CreatedBy;
                _MarkAddHistoryEntity.UpdatedDate = UpdatedDate;
                _MarkAddHistoryEntity.UpdatedBy = UpdatedBy;
                _MarkAddHistoryEntity.IsDeleted = IsDeleted;
                adapter.SaveEntity(_MarkAddHistoryEntity, true);
            }
            return _MarkAddHistoryEntity;
        }
Ejemplo n.º 5
0
        public bool Update(Guid Id, Guid CustomerId, Guid CodeMarkId, DateTime Date, long MarkBeforeAdd, long MarkAfterAdd, DateTime CreatedDate, string CreatedBy, DateTime UpdatedDate, string UpdatedBy, bool IsDeleted)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                MarkAddHistoryEntity _MarkAddHistoryEntity = new MarkAddHistoryEntity(Id);
                if (adapter.FetchEntity(_MarkAddHistoryEntity))
                {

                    _MarkAddHistoryEntity.CustomerId = CustomerId;
                    _MarkAddHistoryEntity.CodeMarkId = CodeMarkId;
                    _MarkAddHistoryEntity.Date = Date;
                    _MarkAddHistoryEntity.MarkBeforeAdd = MarkBeforeAdd;
                    _MarkAddHistoryEntity.MarkAfterAdd = MarkAfterAdd;
                    _MarkAddHistoryEntity.CreatedDate = CreatedDate;
                    _MarkAddHistoryEntity.CreatedBy = CreatedBy;
                    _MarkAddHistoryEntity.UpdatedDate = UpdatedDate;
                    _MarkAddHistoryEntity.UpdatedBy = UpdatedBy;
                    _MarkAddHistoryEntity.IsDeleted = IsDeleted;
                    adapter.SaveEntity(_MarkAddHistoryEntity, true);
                    toReturn = true;
                }
            }
            return toReturn;
        }
Ejemplo n.º 6
0
 public bool Update(MarkAddHistoryEntity _MarkAddHistoryEntity, RelationPredicateBucket filter)
 {
     bool toReturn = false;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         adapter.UpdateEntitiesDirectly(_MarkAddHistoryEntity, filter);
         toReturn = true;
     }
     return toReturn;
 }
Ejemplo n.º 7
0
        public bool Update(MarkAddHistoryEntity _MarkAddHistoryEntity)
        {
            bool toReturn = false;
            using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
            {
                RelationPredicateBucket filter = new RelationPredicateBucket();
                IPredicateExpression _PredicateExpression = new PredicateExpression();
                _PredicateExpression.Add(MarkAddHistoryFields.Id == _MarkAddHistoryEntity.Id);

                filter.PredicateExpression.Add(_PredicateExpression);

                adapter.UpdateEntitiesDirectly(_MarkAddHistoryEntity, filter);
                toReturn = true;
            }
            return toReturn;
        }
Ejemplo n.º 8
0
 public MarkAddHistoryEntity SelectOne(Guid Id)
 {
     MarkAddHistoryEntity toReturn = null;
     using(DataAccessAdapterBase adapter = (new DataAccessAdapterFactory()).CreateAdapter())
     {
         MarkAddHistoryEntity _MarkAddHistoryEntity = new MarkAddHistoryEntity(Id);
         if (adapter.FetchEntity(_MarkAddHistoryEntity))
         {
             toReturn = _MarkAddHistoryEntity;
         }
     }
     return toReturn;
 }
Ejemplo n.º 9
0
    protected void btSubmit_Click(object sender, EventArgs e)
    {
        if (!string.IsNullOrEmpty(Util.CurrentUserName))
        {
            CodeMarkEntity obj = CodeMarkManager.CreateInstant().GetByCode(txtCode.Text.Trim());
            if (obj != null)
            {
                // chi tiet nop tien
                MarkAddHistoryEntity hisobj = new MarkAddHistoryEntity();

                // kt user da ton tai trong bang customer chua
                CustomersEntity CusObj=new CustomersEntity();
                CustomersEntity CusTemp = CustomersManager.CreateInstant().GetByName(Util.CurrentUserName);
                if (CusTemp != null) //kt user da ton tai trong bang customer chua
                {
                    if (CusTemp.Mark < Modules.Document.DocumentConfig.MaxMark)
                    {
                        hisobj.MarkBeforeAdd = CusTemp.Mark;

                        CusObj = CusTemp;
                        CusObj.Mark = CusObj.Mark + obj.Mark;
                        CustomersManager.CreateInstant().Update(CusObj);
                    }
                    else
                    {
                        CustomValidator1.ErrorMessage = "Số điểm hiện tại của bạn đã đạt giới hạn (giới hạn: "+ Modules.Document.DocumentConfig.MaxMark+" điểm), vui lòng giữ lại mã số và nạp điểm vào lần sau";
                        CustomValidator1.IsValid = false;
                        return;
                    }
                }
                else
                {
                    hisobj.MarkBeforeAdd = 0;

                    CusObj.Id = Guid.NewGuid();
                    CusObj.UserName = Util.CurrentUserName;
                    CusObj.FullName = Profile.FullName;
                    CusObj.Mark = obj.Mark;
                    CustomersManager.CreateInstant().Insert(CusObj);
                }
                hisobj.Id = Guid.NewGuid();
                hisobj.CustomerId = CusObj.Id;
                hisobj.CodeMarkId = obj.Id;
                hisobj.Date = DateTime.Now;
                hisobj.MarkAfterAdd = CusObj.Mark;
                hisobj.CreatedBy = Util.CurrentUserName;
                hisobj.CreatedDate = DateTime.Now;
                hisobj.IsDeleted = false;
                MarkAddHistoryManager.CreateInstant().Insert(hisobj);

                obj.IsDeleted = true;
                CodeMarkManager.CreateInstant().Update(obj);

                CustomValidator1.ErrorMessage = "Nạp điểm thành công";
                CustomValidator1.IsValid = false;
            }
            else
            {
                CustomValidator1.ErrorMessage = "Mã số không tồn tại";
                CustomValidator1.IsValid = false;
                return;
            }
        }
        else
            Response.Redirect(CheckRoles.CreateInstant().GetUrlDirect(Request.RawUrl));
    }