Exemple #1
0
 private void AccountNameInquiry(DataEncode DataRequest, ref DataEncode DataResponse, Sta ta, LogMessage LogMessage)
 {
     try
     {
         DataResponse.TransactionMessageCode = "0110";
         ServiceOther ServiceOTH = new ServiceOther();
         if (DataRequest.TransactionCode == 31) //To AC : name Query [***ห้ามเป็นภาษาไทย]
         {
             String Member_Name = "";
             Member_Name = ServiceOTH.GetAccountName(DataRequest.COOPCustomerID.ToString("00000000"), LogMessage, ta);
             if (Member_Name == "")
             {
                 LogMessage.WriteLog("", "NOT HAVE ACCOUNT IN COOP (ไม่พบเลขทะเบียนสมาชิกนี้ในระบบ)");
                 DataResponse.ResponseCode = ResponseCode.AccountNotAuthorize;
                 LogMessage.WriteLog("ResponseCode", "[" + ResponseCode.AccountNotAuthorize + "] Account not authorize, Contact bank");
             }
             else
             {
                 DataResponse.IssuerReference = Member_Name;
             }
         }
     }
     catch (Exception ex)
     {
         Result = DataResponse.DataMassage;
         throw ex;
     }
 }
Exemple #2
0
        public ActionResult Edit(ServiceOther ServiceOther, string codeSystem, string typeName)
        {
            ServiceOther.ServiceOtherId = Convert.ToInt32(DefineFuntion.Decrypt(codeSystem));
            int ms = 0;
            var me = db.ServiceOthers.Find(ServiceOther.ServiceOtherId);

            try
            {
                var dat = DateTime.Now.ToString("MM'/'dd'/'yyyy HH:mm:ss");

                me.Name        = ServiceOther.Name;
                me.Status      = ServiceOther.Status;
                me.Address     = ServiceOther.Address;
                me.AddressShow = ServiceOther.AddressShow;
                me.Description = ServiceOther.Description;
                me.Contents    = ServiceOther.Contents;
                me.UpdateBy    = ServiceOther.UpdateBy = @User.Identity.GetUserName();
                me.UpdateDay   = ServiceOther.UpdateDay = DateTime.Parse(dat);
                db.SaveChanges();
                ms = 3;//Nếu cập nhật thành công
                //1-them, 2- sua, 3-xoa, 4- khac
                shared.CreateHistory(new History()
                {
                    Name    = "Cập Nhật Dịch Vụ",
                    Contens = JsonConvert.SerializeObject(me, Formatting.Indented, new JsonSerializerSettings()
                    {
                        ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
                    }),
                    ItemId = me.ServiceOtherId,
                    Type   = (int)DefineFuntion.TypeHistory.ServiceOther,
                });
            }
            catch (Exception)
            {
                ms = 4;//Nếu cập nhật không thành công
            }
            if (typeName == "savenew" || typeName == "")
            {
                return(RedirectToAction("Create", new { mess = ms }));
            }
            else
            {
                return(RedirectToAction("Edit", new { id = codeSystem, mess = ms }));
            }
        }
Exemple #3
0
        public ActionResult Create(ServiceOther ServiceOther, string typeName)
        {
            var shared = new SharedFuntionController();
            int ms     = 0;

            try
            {
                var dat = DateTime.Now.ToString("MM'/'dd'/'yyyy HH:mm:ss");

                ServiceOther.CreateBy  = @User.Identity.GetUserName();
                ServiceOther.CreateDay = DateTime.Parse(dat);
                db.ServiceOthers.Add(ServiceOther);
                db.SaveChanges();
                ms = 1;
                //1-them, 2- sua, 3-xoa, 4- khac
                shared.CreateHistory(new History()
                {
                    Name    = "Thêm Dịch Vụ",
                    Contens = "",
                    ItemId  = ServiceOther.ServiceOtherId,
                    Type    = (int)DefineFuntion.TypeHistory.ServiceOther,
                });
            }
            catch (Exception)
            {
                ms = 2;
            }
            if (ms != 2)
            {
                if (typeName == "savenew" || typeName == "")
                {
                    return(RedirectToAction("Create", new { mess = ms }));
                }
                else
                {
                    return(RedirectToAction("Edit", new { id = DefineFuntion.Encrypt(ServiceOther.ServiceOtherId), mess = ms }));
                }
            }
            ViewBag.Status = new SelectList(DefineFuntion.ListStatus, "Value", "Text", ServiceOther.Status);
            return(View("Create", "ServiceOther"));
        }
Exemple #4
0
        public int DeleteConfirmed(string[] inputCheck)
        {
            //System.Windows.Forms.DialogResult dailogresult = System.Windows.Forms.MessageBox.Show("Bạn có chắc chắn xóa!", "Thông báo", System.Windows.Forms.MessageBoxButtons.YesNo);
            int rowFinish = 0;

            if (inputCheck == null)
            {
                return(rowFinish);
            }
            foreach (var s in inputCheck)
            {
                try
                {
                    int          idMenu = Convert.ToInt32(DefineFuntion.Decrypt(s));
                    ServiceOther obj    = db.ServiceOthers.Find(idMenu);
                    //1-them, 2- sua, 3-xoa, 4- khac
                    shared.CreateHistory(new History()
                    {
                        Name    = "Xóa Dịch Vụ",
                        Contens = JsonConvert.SerializeObject(obj, Formatting.Indented, new JsonSerializerSettings()
                        {
                            ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
                        }),
                        ItemId = obj.ServiceOtherId,
                        Type   = (int)DefineFuntion.TypeHistory.ServiceOther,
                    });
                    db.ServiceOthers.Remove(obj);
                    db.SaveChanges();
                    rowFinish++;
                }
                catch (Exception)
                {
                    int          idMenu = Convert.ToInt32(DefineFuntion.Decrypt(s));
                    ServiceOther obj    = db.ServiceOthers.Find(idMenu);
                    obj.Status = 3;
                    db.SaveChanges();
                }
            }
            return(rowFinish);
        }