Exemple #1
0
        public JsonResult Select_List_Admin_Info(string text, string value)
        {
            var temp = Services_Admin_Info.Instance().ListMany(a => a.Status != "Deleted" && a.Status != "Blocked")
                       .ToList();

            List <SelectListItem> list = new List <SelectListItem>();

            if (!string.IsNullOrEmpty(text) && !string.IsNullOrEmpty(value))
            {
                list.Add(new SelectListItem
                {
                    Text     = text,
                    Selected = true,
                    Value    = value
                });
            }

            foreach (var item in temp)
            {
                list.Add(new SelectListItem
                {
                    Text  = item.Code + " - " + item.FullName,
                    Value = item.ID.ToString()
                });
            }

            return(Json(list));
        }
Exemple #2
0
        public JsonResult Event_Add_Edit_Admin_Info(Admin_Info obj)
        {
            obj.Create_User = Session["user"].ToString();
            var result = Services_Admin_Info.Instance().Event_Add_Edit_Admin_Info(obj);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemple #3
0
        public ActionResult Admin_Info_Table()
        {
            var list = Services_Admin_Info.Instance().ListMany(a => a.Status != "Deleted").ToList();

            ViewData["list_admin_info"] = list;

            return(PartialView());
        }
Exemple #4
0
        public ActionResult Edit_Admin_Info(string id)
        {
            int idAdmin = int.Parse(id);

            ViewData["admin_info"] = Services_Admin_Info.Instance().Get(a => a.ID == idAdmin);

            return(PartialView());
        }
Exemple #5
0
        public JsonResult Event_Delete_Admin_Info(string id, string user)
        {
            var result = Services_Admin_Info.Instance().Event_Delete_Admin_Info(id, user);

            return(Json(result));
        }
Exemple #6
0
        public JsonResult Event_Import_Event_Info(int rowIndex)
        {
            List <Message> ms_error = new List <Message>();

            if (Session["event_payment_error"] != null)
            {
                ms_error = (List <Message>)Session["list_file_error"];
            }

            Message   ms  = new Message();
            DataTable dt  = (DataTable)Session["event_payment"];
            DataTable dt2 = (DataTable)Session["history_payment"];
            DataTable dt3 = (DataTable)Session["service_cost"];

            var rowCurrent = dt.Rows[rowIndex];
            int id_Admin   = Services_Admin_Info.Instance().Get_ID_Admin(rowCurrent[1].ToString());

            if (id_Admin == 0)
            {
                ms.code = "1";
                ms.msg  = "Code admin của bạn không tồn tại , vui lòng kiểm tra lại . Cảm ơn !";
                return(Json(ms));
            }

            Event_Info model = new Event_Info()
            {
                Id_Admin_Info = id_Admin,
                Abbott_Code   = !string.IsNullOrEmpty(rowCurrent[2].ToString()) ? rowCurrent[2].ToString() : "",
                Name          = !string.IsNullOrEmpty(rowCurrent[3].ToString()) ? rowCurrent[3].ToString() : "",
                Event_Time    = !string.IsNullOrEmpty(rowCurrent[4].ToString()) ? DateTime.Parse(rowCurrent[4].ToString()) : (DateTime?)null,
                Request_Date  = !string.IsNullOrEmpty(rowCurrent[5].ToString()) ? DateTime.Parse(rowCurrent[5].ToString()) : (DateTime?)null,
                Area          = !string.IsNullOrEmpty(rowCurrent[6].ToString()) ? rowCurrent[6].ToString() : "",
                Description   = !string.IsNullOrEmpty(rowCurrent[7].ToString()) ? rowCurrent[7].ToString() : "",
                Note          = !string.IsNullOrEmpty(rowCurrent[8].ToString()) ? rowCurrent[8].ToString() : "",
                Status        = "Actived",
                Create_User   = Session["user"].ToString(),
                Create_Date   = DateTime.Now
            };

            ms = Services_Event_Info.Instance().Event_Import_Event_Info(model, rowIndex);
            var id_event = int.Parse(ms.sub_code);

            if (ms.code == "0")
            {
                dt2        = (DataTable)Session["history_payment"];
                rowCurrent = dt2.Rows[rowIndex];
                bool invoice_abb = false;
                if (rowCurrent[12].ToString().Equals("0"))
                {
                    invoice_abb = true;
                }

                History_Payment add2 = new History_Payment()
                {
                    HCP_Code             = !string.IsNullOrEmpty(rowCurrent[1].ToString()) ? rowCurrent[1].ToString() : "",
                    Number_Contract      = !string.IsNullOrEmpty(rowCurrent[2].ToString()) ? rowCurrent[2].ToString() : "",
                    FromDate             = !string.IsNullOrEmpty(rowCurrent[3].ToString()) ? DateTime.Parse(rowCurrent[3].ToString()) : (DateTime?)null,
                    ToDate               = !string.IsNullOrEmpty(rowCurrent[4].ToString()) ? DateTime.Parse(rowCurrent[4].ToString()) : (DateTime?)null,
                    Value_Contract       = !string.IsNullOrEmpty(rowCurrent[5].ToString()) ? Double.Parse(rowCurrent[5].ToString()) : (Double?)null,
                    PPL_GetContract_Date = !string.IsNullOrEmpty(rowCurrent[6].ToString()) ? DateTime.Parse(rowCurrent[6].ToString()) : (DateTime?)null,
                    Rep_Name             = !string.IsNullOrEmpty(rowCurrent[7].ToString()) ? rowCurrent[7].ToString() : "",
                    Sup_Name             = !string.IsNullOrEmpty(rowCurrent[8].ToString()) ? rowCurrent[8].ToString() : "",
                    Description          = !string.IsNullOrEmpty(rowCurrent[9].ToString()) ? rowCurrent[9].ToString() : "",
                    PPL_Payment_Date     = !string.IsNullOrEmpty(rowCurrent[10].ToString()) ? DateTime.Parse(rowCurrent[10].ToString()) : (DateTime?)null,
                    Payment_Value        = !string.IsNullOrEmpty(rowCurrent[11].ToString()) ? Double.Parse(rowCurrent[11].ToString()) : (Double?)null,
                    Invoice_Abbott       = invoice_abb,
                    Report_Abbott_Date   = !string.IsNullOrEmpty(rowCurrent[13].ToString()) ? DateTime.Parse(rowCurrent[13].ToString()) : (DateTime?)null,
                    Note        = !string.IsNullOrEmpty(rowCurrent[14].ToString()) ? rowCurrent[14].ToString() : "",
                    Status      = "Actived",
                    Create_User = Session["user"].ToString(),
                    Create_Date = DateTime.Now
                };
                ms = Services_History_Payment.Instance().Event_Import_History_Payment(add2, rowIndex, id_event);
            }
            if (ms.code == "0")
            {
                if (dt3.Rows.Count > (rowIndex))
                {
                    dt3        = (DataTable)Session["service_cost"];
                    rowCurrent = dt3.Rows[rowIndex];

                    Service_Cost add3 = new Service_Cost()
                    {
                        ID_Service_Criteria = int.Parse(rowCurrent[0].ToString()),
                        Honorarium_fee      = Double.Parse(rowCurrent[1].ToString()),
                        Air_ticket          = Double.Parse(rowCurrent[2].ToString()),
                        Meal_fee            = Double.Parse(rowCurrent[3].ToString()),
                        Hotel_fee           = Double.Parse(rowCurrent[4].ToString()),
                        Car_rental          = Double.Parse(rowCurrent[5].ToString()),
                        Other_fees          = Double.Parse(rowCurrent[6].ToString()),
                        Total_costs         = Double.Parse(rowCurrent[7].ToString()),
                        Status      = "Actived",
                        Create_User = Session["user"].ToString(),
                        Create_Date = DateTime.Now
                    };
                    ms = Services_service_costs.Instance().Event_Import_Service_Cost(add3, rowIndex, id_event);
                }
            }

            if (ms.code == "1")
            {
                ms_error.Add(ms);
                ms.code = "0";
            }
            if (rowIndex == dt.Rows.Count - 1)
            {
                if (ms_error.Count > 0)
                {
                    Session["list_file_error"] = ms_error;
                    ms.code     = "1";
                    ms.msg      = "Vui lòng xem file Excel Lỗi !";
                    ms.sub_code = "Danh Sách Thông Tin Sự Kiện & Thanh Toán Lỗi";
                }
                else
                {
                    ms.code = "2";
                    ms.msg  = "Đã Up Danh Sách Thông Tin Sự Kiện & Thanh Toán Thành Công";
                }
            }
            else
            {
                Session["list_file_error"] = ms_error;
            }
            return(Json(ms));
        }