Esempio n. 1
0
        private StringBuilder PrepareDataJson_DanhSachTaiKhoan(TaiKhoanModels model, int couter)
        {
            StringBuilder sbResult = new StringBuilder();

            try
            {
                sbResult.Append("{");
                sbResult.Append("\"col_class\":\"rows-box\",");
                sbResult.Append("\"col_id\":\"" + model.mataikhoan + "\",");
                sbResult.Append("\"col_value\":[");
                #region Data cell
                //colum checkbox
                string strHTML_Checkbox = string.Format("<input type='checkbox' onclick='Select(this);' class='chkCheck' codeid='{0}'/>", model.mataikhoan);
                sbResult.Append("{");
                sbResult.Append("\"colspan\":\"1\",");
                sbResult.Append("\"col_class\":\"ovh col1\",");
                sbResult.Append("\"col_id\":\"1\",");
                sbResult.Append("\"col_value\":\"" + strHTML_Checkbox + "\"");
                sbResult.Append("},");
                //stt
                sbResult.Append("{");
                sbResult.Append("\"colspan\":\"1\",");
                sbResult.Append("\"col_class\":\"ovh col2 stt\",");
                sbResult.Append("\"col_id\":\"2\",");
                sbResult.Append("\"col_value\":\"" + couter + "\"");
                sbResult.Append("},");

                //tinh trang
                FunctionXML fnc = new FunctionXML(Functions.MapPath("~/Xml/Const/Default.xml"));
                sbResult.Append("{");
                sbResult.Append("\"colspan\":\"1\",");
                sbResult.Append("\"col_class\":\"ovh col3\",");
                sbResult.Append("\"col_id\":\"3\",");
                sbResult.Append("\"title\":\"" + model.tinhtrang.Trim() + "\",");
                sbResult.Append("\"col_value\":\"" + fnc.ReadConst("kichhoat", int.Parse(model.tinhtrang)) + "\"");
                sbResult.Append("},");

                //noi dung
                sbResult.Append("{");
                sbResult.Append("\"colspan\":\"1\",");
                sbResult.Append("\"col_class\":\"ovh col4\",");
                sbResult.Append("\"col_id\":\"4\",");
                sbResult.Append("\"title\":\"" + model.grouptk + "\",");
                sbResult.Append("\"col_value\":\"" + model.tendangnhap + "\"");
                sbResult.Append("},");
                //ten dang nhap
                sbResult.Append("{");
                sbResult.Append("\"colspan\":\"1\",");
                sbResult.Append("\"col_class\":\"ovh col5\",");
                sbResult.Append("\"col_id\":\"5\",");
                sbResult.Append("\"title\":\"" + model.grouptk + "\",");
                sbResult.Append("\"col_value\":\"" + model.hoten + "\"");
                sbResult.Append("},");

                //Email
                sbResult.Append("{");
                sbResult.Append("\"colspan\":\"1\",");
                sbResult.Append("\"col_class\":\"ovh col6\",");
                sbResult.Append("\"col_id\":\"6\",");
                sbResult.Append("\"col_value\":\"" + model.thudientu + "\"");
                sbResult.Append("},");

                //phong ban
                sbResult.Append("{");
                sbResult.Append("\"colspan\":\"1\",");
                sbResult.Append("\"col_class\":\"ovh col7\",");
                sbResult.Append("\"col_id\":\"7\",");
                sbResult.Append("\"title\":\"" + model.maphongban.Trim() + "\",");
                sbResult.Append("\"col_value\":\"" + model.tenphongban + "\"");
                sbResult.Append("},");

                //chucdanh
                sbResult.Append("{");
                sbResult.Append("\"colspan\":\"1\",");
                sbResult.Append("\"col_class\":\"ovh col11\",");
                sbResult.Append("\"col_id\":\"11\",");
                sbResult.Append("\"title\":\"" + model.macongtruong.Trim() + "\",");
                sbResult.Append("\"col_value\":\"" + model.tencongtruong + "\"");
                sbResult.Append("},");

                //chucdanh
                sbResult.Append("{");
                sbResult.Append("\"colspan\":\"1\",");
                sbResult.Append("\"col_class\":\"ovh col12\",");
                sbResult.Append("\"col_id\":\"12\",");
                sbResult.Append("\"title\":\"" + model.loaicuochop + "\",");
                if (model.loaicuochop == 1)
                {
                    sbResult.Append("\"col_value\":\"" + "Trưởng PB/CT" + "\"");
                }
                else if (model.loaicuochop == 2)
                {
                    sbResult.Append("\"col_value\":\"" + "Thiết Bị" + "\"");
                }
                else if (model.loaicuochop == 3)
                {
                    sbResult.Append("\"col_value\":\"" + "HSSE" + "\"");
                }
                else if (model.loaicuochop == 4)
                {
                    sbResult.Append("\"col_value\":\"" + "QAQC" + "\"");
                }
                else if (model.loaicuochop == 5)
                {
                    sbResult.Append("\"col_value\":\"" + "MEP" + "\"");
                }
                else
                {
                    sbResult.Append("\"col_value\":\"" + "Khác" + "\"");
                }
                sbResult.Append("},");

                //chucdanh
                sbResult.Append("{");
                sbResult.Append("\"colspan\":\"1\",");
                sbResult.Append("\"col_class\":\"ovh col8\",");
                sbResult.Append("\"col_id\":\"8\",");
                sbResult.Append("\"title\":\"" + model.chucdanhkpi + "\",");
                sbResult.Append("\"col_value\":\"" + model.tenchucdanhkpi + "\"");
                sbResult.Append("},");

                //chucdanh
                sbResult.Append("{");
                sbResult.Append("\"colspan\":\"1\",");
                sbResult.Append("\"col_class\":\"ovh col9\",");
                sbResult.Append("\"col_id\":\"9\",");
                sbResult.Append("\"title\":\"" + model.madonvi + "\",");
                sbResult.Append("\"col_value\":\"" + model.tendonvi + "\"");
                sbResult.Append("},");



                //dinh kem tap tin
                string strHTML_Attachment = "";
                #region
                string link = Url.Action("Edit", "Account", new { id = EncDec.EncodeCrypto(model.mataikhoan) });
                strHTML_Attachment = "<a href='#' class='edit' ><i class='fa fa-pencil-square-o' ></i></a>&nbsp;    <a href='#' class='del'><i class='fa fa-trash-o' ></i></a>";
                #endregion
                sbResult.Append("{");
                sbResult.Append("\"colspan\":\"1\",");
                sbResult.Append("\"col_class\":\"ovh col10\",");
                sbResult.Append("\"col_id\":\"10\",");
                sbResult.Append("\"col_value\":\"" + strHTML_Attachment + "\"");
                sbResult.Append("}");

                ////chucdanh
                //sbResult.Append("{");
                //sbResult.Append("\"colspan\":\"1\",");
                //sbResult.Append("\"col_class\":\"ovh col11\",");
                //sbResult.Append("\"col_id\":\"11\",");
                //sbResult.Append("\"type\":\"hidden\",");
                //sbResult.Append("\"col_value\":\"" + model.mataikhoan + "\"");
                //sbResult.Append("}");


                #endregion

                sbResult.Append("]");
                sbResult.Append("},");
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
            }
            return(sbResult);
        }