コード例 #1
0
ファイル: IndexController.cs プロジェクト: CiNguyen/code_hcp
        public JsonResult Event_Import_HCP_Info(int rowIndex)
        {
            List <Message> ms_error = new List <Message>();

            if (Session["hcp_info_error"] != null)
            {
                ms_error = (List <Message>)Session["sos_schedule_error"];
            }
            Message   ms = new Message();
            DataTable dt = (DataTable)Session["hcp_info"];

            var rowCurrent = dt.Rows[rowIndex];

            HCP_Info model = new HCP_Info()
            {
                Full_Name    = rowCurrent[1].ToString(),
                Birth_Day    = !string.IsNullOrEmpty(rowCurrent[2].ToString()) ? DateTime.Parse(rowCurrent[2].ToString()) : (DateTime?)null,
                Address      = rowCurrent[3].ToString(),
                Citizen_ID   = !string.IsNullOrEmpty(rowCurrent[4].ToString()) ? rowCurrent[4].ToString() : "",
                Issue_Date   = !string.IsNullOrEmpty(rowCurrent[5].ToString()) ? DateTime.Parse(rowCurrent[5].ToString()) : (DateTime?)null,
                Place_Issue  = rowCurrent[6].ToString(),
                PIT_Code     = rowCurrent[7].ToString(),
                Position     = rowCurrent[8].ToString(),
                Bank_Name    = rowCurrent[9].ToString(),
                Bank_Account = rowCurrent[10].ToString(),
                Note         = rowCurrent[11].ToString(),
                Create_User  = Session["user"].ToString(),
                Create_Date  = DateTime.Now
            };

            ms = Services_HCP_Info.Instance().Event_Import_HCP_Info(model, rowIndex);

            if (ms.code == "1")
            {
                ms_error.Add(ms);
                ms.code = "0";
            }
            if (rowIndex == dt.Rows.Count - 1)
            {
                if (ms_error.Count > 0)
                {
                    Session["sos_schedule_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 Chấm SOS Lỗi";
                }
                else
                {
                    ms.code = "2";
                    ms.msg  = "Đã Up Danh Sách Thông Tin Chấm SOS Thành Công";
                }
            }
            else
            {
                Session["sos_schedule_error"] = ms_error;
            }
            return(Json(ms));
        }
コード例 #2
0
ファイル: IndexController.cs プロジェクト: CiNguyen/code_hcp
        public ActionResult Event_Add_Edit_HCP_Info(string data, string CMND_MT, string CMND_MS, string issue)
        {
            Message  ms         = new Message();
            DateTime issue_date = Convert.ToDateTime(issue);
            HCP_Info hcp        = JsonConvert.DeserializeObject <HCP_Info>(data);
            string   cm_truoc   = Cut_Image(CMND_MT);
            string   cm_sau     = Cut_Image(CMND_MS);

            hcp.CMND_MT     = ResizeBase64String_500(cm_truoc);
            hcp.CMND_MS     = ResizeBase64String_500(cm_sau);
            hcp.Status      = "Update";
            hcp.Issue_Date  = issue_date;
            hcp.Create_Date = DateTime.Now.Date;
            hcp.Create_User = Session["user"].ToString();
            ms = Services_HCP_Info.Instance().Event_Add_Edit_HCP(hcp);
            return(Json(ms));
        }