Exemple #1
0
        public JsonResult CreateUserRegistraion(UserModel objUserModel)
        {
            List <UserModel> UserRegistrationlist = new List <UserModel>();

            UserRegistrationlist.Add(objUserModel);
            ListtoDataTableConverter converter = new ListtoDataTableConverter();
            DataTable dt = new DataTable();

            dt = converter.ToDataTable(UserRegistrationlist);

            Account mm  = new Account();
            string  res = "";

            try
            {
                res = loginLayer.CreateUserRegistration(dt);

                string[] response = res.Split(',');
                if (response[0] == "Success")
                {
                    mm.SuccessMsg = response[1];
                }
                else if (response[0] == "Error")
                {
                    mm.ErrorMsg = response[1];
                }
            }
            catch (Exception ex)
            {
                mm.ErrorMsg = ex.Message;
            }
            return(Json(mm, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public int Save(MonthlyTransactionInsert monthlyTransaction)
        {
            DataTable inputTable = ListtoDataTableConverter.ToDataTable(monthlyTransaction.MonthlyTransactions);


            using (SqlCommand cmd = new SqlCommand())
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "InsertMonthlyTransaction";

                cmd.Parameters.AddWithValue("@MonthlyTransaction", inputTable);

                cmd.Parameters.AddWithValue("@KamethiNumber", monthlyTransaction.KamethiNumber);

                cmd.Parameters.AddWithValue("@HostId", monthlyTransaction.HostId);

                cmd.Parameters.AddWithValue("@TotalTakenAmount", monthlyTransaction.TotalTakenAmount);

                cmd.Parameters.AddWithValue("@TotalDepositAmount", monthlyTransaction.TotalDepositeAmount);

                cmd.Parameters.AddWithValue("@RemainingBalance", monthlyTransaction.TotalBalanceAmount);

                return(Execute(cmd, ConfigurationHelper.ConnectionString));
            }
        }
        public JsonResult CreateMasterSetting(MasterSettingModel objSettingModel)
        {
            List <MasterSettingModel> MasterSettingModellist = new List <MasterSettingModel>();

            MasterSettingModellist.Add(objSettingModel);
            ListtoDataTableConverter converter = new ListtoDataTableConverter();
            DataTable dt = new DataTable();

            dt = converter.ToDataTable(MasterSettingModellist);

            homeModel hm  = new homeModel();
            string    res = "";

            try
            {
                res = admin_layer.CreateMasterSetting(dt);

                string[] response = res.Split(',');
                if (response[0] == "Success")
                {
                    hm.SuccessMsg = response[1];
                }
                else if (response[0] == "Error")
                {
                    hm.ErrorMsg = response[1];
                }
            }
            catch (Exception ex)
            {
                hm.ErrorMsg = ex.Message;
            }
            return(Json(hm, JsonRequestBehavior.AllowGet));
        }
Exemple #4
0
        public async Task <Tuple <DataTable, String> > GetProductDownloadData(int companyId, int catalogId)
        {
            CatalogModel objCatalogModel = new CatalogModel();

            objCatalogModel = await GetCompanyCatalog(companyId, catalogId);

            DataTable dtAllCatalog             = new DataTable();
            ListtoDataTableConverter converter = new ListtoDataTableConverter();

            foreach (var Product in objCatalogModel.Products)
            {
                var dty = converter.ToDataTable(Product.ProductItems, Product.Vendor + " " + Product.Name);
                dtAllCatalog.Merge(dty);
            }
            ///Removing  unwanted Column
            if (dtAllCatalog != null)
            {
                if (dtAllCatalog.Columns.Count > 0)
                {
                    dtAllCatalog = RemoveRenameProductTable(dtAllCatalog);
                }
            }
            return(Tuple.Create(dtAllCatalog, objCatalogModel.Name));
            //return dtAllCatalog;
        }
        public ActionResult Export()
        {
            ExcelPackage excel = new ExcelPackage();

            ApplicationDbContext db = new ApplicationDbContext();

            DataTable dt = new DataTable();

            ExcelWorksheet ws = excel.Workbook.Worksheets.Add("Demo");

            //here you have to add your class like student etc.
            List <Firma> firm = db.Firms.ToList <Firma>();

            ListtoDataTableConverter converter = new ListtoDataTableConverter();

            dt = converter.ToDataTable(firm);

            ws.Cells["A1"].LoadFromDataTable(dt, true, TableStyles.Medium15);

            ws.Cells.AutoFitColumns();

            using (var memoryStream = new MemoryStream())
            {
                Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                Response.AddHeader("content-disposition", "attachment; filename=ExportTest" + excel + ".xlsx");
                excel.SaveAs(memoryStream);
                memoryStream.WriteTo(Response.OutputStream);
                Response.Flush();
                Response.End();
            }


            return(RedirectToAction("ViewFirms", "Firme"));
        }
Exemple #6
0
        public JsonResult save_hierarchy(string TableData)
        {
            successFailureModel sm = new successFailureModel();

            try
            {
                var serializeData = JsonConvert.DeserializeObject <List <HierarchyModel> >(TableData);

                ListtoDataTableConverter converter = new ListtoDataTableConverter();

                DataTable dt = converter.ToDataTable(serializeData);

                string   res      = dblayer.save_hierarchy(dt);
                string[] response = res.Split(',');
                if (response[0] == "Success")
                {
                    sm.SuccessMsg = response[1];
                }
                else
                {
                    sm.ErrorMsg = response[1];
                }
            }
            catch (Exception ex)
            {
                sm.ErrorMsg = ex.Message;
            }
            return(Json(sm, JsonRequestBehavior.AllowGet));
        }
Exemple #7
0
        private void btnView_Click(object sender, EventArgs e)
        {
            reportViewerStudentAdmission.RefreshReport();
            List <StudentPersonalInfo> studentpersoninfos = StudentPersonalInfoController.StudentPersonalInfoSelectAll();
            ListtoDataTableConverter   converter          = new ListtoDataTableConverter();
            DataTable dt = converter.ToDataTable(studentpersoninfos);
            DataSet   studentDataSet_PersonalInfo = new DataSet();

            studentDataSet_PersonalInfo.Tables.Add(dt);
        }
Exemple #8
0
        public string Create_Expense(int EMP_ID, ExpenseEntities EXP, List <ExpenseFiles> files)
        {
            string response = "";
            ListtoDataTableConverter converter = new ListtoDataTableConverter();

            try
            {
                DataTable dt_files = new DataTable();

                if (files != null)
                {
                    dt_files = converter.ToDataTable(files);
                }
                else
                {
                    dt_files.Columns.Add("file_name");
                }

                connection();
                using (SqlCommand cmd = new SqlCommand("Prc_InsertExpense", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@ID", EXP.EXPENSE_ID);
                    cmd.Parameters.AddWithValue("@EXPENSE_CODE", EXP.EXPENSE_CODE);
                    cmd.Parameters.AddWithValue("@EMP_ID", EMP_ID);
                    cmd.Parameters.AddWithValue("@EXPENSE_TYPE_ID", EXP.EXPENSE_TYPE_ID);
                    cmd.Parameters.AddWithValue("@EXPENSE_DATE", EXP.EXPENSE_DATE);
                    cmd.Parameters.AddWithValue("@PROJECT_ID", EXP.PROJECT_ID);
                    cmd.Parameters.AddWithValue("@TRAVEL_FROM", EXP.TRAVEL_FROM);
                    cmd.Parameters.AddWithValue("@TRAVEL_TO", EXP.TRAVEL_TO);
                    cmd.Parameters.AddWithValue("@TRAVEL_DISTANCE", EXP.TRAVEL_DISTANCE);
                    cmd.Parameters.AddWithValue("@TRAVEL_MODE_ID", EXP.TRAVEL_MODE);
                    cmd.Parameters.AddWithValue("@EXPENSE_AMT", EXP.EXPENSE_AMOUNT);
                    cmd.Parameters.AddWithValue("@DESCRIPTION", EXP.DESCRIPTION);
                    cmd.Parameters.AddWithValue("@files_tbl", dt_files);

                    SqlParameter outData = new SqlParameter();
                    outData.ParameterName = "@MESSAGE";
                    outData.SqlDbType     = SqlDbType.NVarChar;
                    outData.Size          = 250;
                    outData.Direction     = ParameterDirection.Output;
                    cmd.Parameters.Add(outData);
                    con.Open();
                    cmd.ExecuteNonQuery();
                    response = Convert.ToString(outData.Value);
                    con.Close();
                }
            }
            catch (Exception ex)
            {
                response = ex.Message;
            }
            return(response);
        }
        public void ExporttoExcelStudentWise()
        {
            var       studentsAttendenceList = _model.GetAttendanceStudentwise_Excel();
            var       converter = new ListtoDataTableConverter();
            DataTable dt        = _model.GetAttendanceStudentwise_Excel();//converter.ToDataTable(studentsAttendenceList);

            HttpContext.Response.Clear();
            HttpContext.Response.ClearContent();
            HttpContext.Response.ClearHeaders();
            HttpContext.Response.Buffer      = true;
            HttpContext.Response.ContentType = "application/ms-excel";
            HttpContext.Response.Write(@"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">");
            HttpContext.Response.AddHeader("Content-Disposition", "attachment;filename=Reports.xls");

            HttpContext.Response.Charset         = "utf-8";
            HttpContext.Response.ContentEncoding = System.Text.Encoding.GetEncoding("windows-1250");
            //sets font
            HttpContext.Response.Write("<font style='font-size:20.0pt; font-family:Calibri;'>");
            HttpContext.Response.Write("<BR><BR><BR>");
            //sets the table border, cell spacing, border color, font of the text, background, foreground, font height
            HttpContext.Response.Write("<Table border='1' bgColor='#FF0000' " +
                                       "borderColor='#ccc' cellSpacing='0' cellPadding='0' " +
                                       "style='font-size:12.0pt; font-family:Calibri; background:#FFF;'> <TR>");
            //am getting my grid's column headers
            int columnscount = dt.Columns.Count;

            for (int j = 0; j < columnscount; j++)
            {      //write in new column
                HttpContext.Response.Write("<Td>");
                //Get column headers  and make it as bold in excel columns
                HttpContext.Response.Write("<B>");
                HttpContext.Response.Write(dt.Columns[j].ToString());//GridView_Result.Columns[j].HeaderText.ToString());
                HttpContext.Response.Write("</B>");
                HttpContext.Response.Write("</Td>");
            }
            HttpContext.Response.Write("</TR>");
            foreach (DataRow row in dt.Rows)
            {//write in new row
                HttpContext.Response.Write("<TR>");
                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    HttpContext.Response.Write("<Td>");
                    HttpContext.Response.Write(row[i].ToString());
                    HttpContext.Response.Write("</Td>");
                }

                HttpContext.Response.Write("</TR>");
            }
            HttpContext.Response.Write("</Table>");
            HttpContext.Response.Write("</font>");
            HttpContext.Response.Flush();
            HttpContext.Response.End();
            //return View();
        }
Exemple #10
0
        public JsonResult CreateAnnualAppraisal(AnnualAppraisalModel objResponsibility, AppraisalPerformanceModel objPerformance, AppraisalRating objRating)
        {
            List <AnnualAppraisalModel> AnnualResponsibilitylist = new List <AnnualAppraisalModel>();

            AnnualResponsibilitylist.Add(objResponsibility);
            ListtoDataTableConverter converter = new ListtoDataTableConverter();
            DataTable dt = new DataTable();

            dt = converter.ToDataTable(AnnualResponsibilitylist);

            List <AppraisalPerformanceModel> AnnualPerformanceList = new List <AppraisalPerformanceModel>();

            AnnualPerformanceList.Add(objPerformance);
            ListtoDataTableConverter PerformanceConverter = new ListtoDataTableConverter();
            DataTable dt1 = new DataTable();

            dt1 = PerformanceConverter.ToDataTable(AnnualPerformanceList);

            List <AppraisalRating> RatingList = new List <AppraisalRating>();

            RatingList.Add(objRating);
            ListtoDataTableConverter RatingConverter = new ListtoDataTableConverter();
            DataTable dt2 = new DataTable();

            dt2 = RatingConverter.ToDataTable(RatingList);

            MastersModel mm  = new MastersModel();
            string       res = "";

            try
            {
                res = ap_layer.CreateAnnualAppraisal(dt, dt1, dt2);

                string[] response = res.Split(',');
                if (response[0] == "Success")
                {
                    mm.SuccessMsg = response[1];
                }
                else if (response[0] == "Error")
                {
                    mm.ErrorMsg = response[1];
                }
            }
            catch (Exception ex)
            {
                mm.ErrorMsg = ex.Message;
            }
            return(Json(mm, JsonRequestBehavior.AllowGet));
        }
        private void txt_SearchCatalogue_TextChanged(object sender, EventArgs e)
        {
            UserBL UserBL = new UserBL();
            List<DO.User> ListUser = UserBL.GetUser();
            ListtoDataTableConverter converter = new ListtoDataTableConverter();
            DataTable dt = converter.ToDataTable(ListUser);

            dgv_UserManagement.DataSource = dt;
            dt.DefaultView.RowFilter = string.Format("UserName LIKE '%{0}%' or Sequence LIKE '%{0}%'", txt_SearchCatalogue.Text);

            dgv_UserManagement.Columns["UserID"].Visible = false;
            dgv_UserManagement.Columns["PassWord"].Visible = false;
            dgv_UserManagement.Columns["Role"].Visible = false;
            dgv_UserManagement.Columns["Sequence"].HeaderText = "STT";
            dgv_UserManagement.Columns["UserName"].HeaderText = "Tên Tài khoản";
            dgv_UserManagement.Columns["Sequence"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
        }
Exemple #12
0
        private void btnViewReport_Click(object sender, EventArgs e)
        {
            try
            {
                clsUser                  objUser   = new clsUser();
                ExcelUtilities           Obj       = new ExcelUtilities();
                ListtoDataTableConverter converter = new ListtoDataTableConverter();
                var pass = objUser.GetExcelPassword();
                // frmRptDateWiseActivity RptDateWiseActivity = new frmRptDateWiseActivity();
                String FromDate = ""; String ToDate = "";
                // List<MemberEnrollment> _mEnrollmentInfo = new List<MemberEnrollment>();
                FromDate = dtpFromDate.Value.ToString("dd-MM-yyyy");
                ToDate   = dtpToDate.Value.ToString("dd-MM-yyyy");

                rptDt = objReport.DateWiseActivityReport(FromDate, ToDate);

                String _Path     = System.Configuration.ConfigurationManager.AppSettings["ReportPath"].ToString();
                String _FileName = "Activity_Log_" + DateTime.Now.ToString("dd-MM-yyyy") + "-" + DateTime.Now.ToString("HH-mm-ss") + ".xlsx";
                Cursor.Current = Cursors.AppStarting;
                if (Obj.WriteDataTableToExcel(rptDt, "Activity_Log", _Path + _FileName, "Details", pass[0].Password))
                {
                    MessageBox.Show("Data has been exported successfully & stored in " + _Path + _FileName, "Activity Log", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Unable to export the data", "Activity_log", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                Cursor.Current = Cursors.Default;

                //if (rptDt.Rows.Count > 0)
                //{
                //    rptDateWiseActivityDetails DateWise = new rptDateWiseActivityDetails();
                //    DateWise.SetDataSource(rptDt);
                //    crystalReportViewer1.ReportSource = DateWise;
                //}
                //else
                //{
                //    crystalReportViewer1.ReportSource = null;
                //    MessageBox.Show("No record found..");
                //}
            }
            catch (Exception ex)
            {
                //log.Error(ex.ToString());
            }
        }
Exemple #13
0
        public string CreateBulkCustomer(List <CustomerEntities> tempCustomer)
        {
            //List<CustomerEntities> custlist = new List<CustomerEntities>();

            //custlist.Add(tempCustomer);
            ListtoDataTableConverter converter = new ListtoDataTableConverter();
            DataTable dt = new DataTable();

            dt = converter.ToDataTable(tempCustomer);
            string res = "";

            try
            {
                connection();
                using (SqlCommand cmd = new SqlCommand("spInsertMST_CUSTOMERBYTableType", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@MST_CUSTOMERTableType", dt);
                    SqlParameter oblogin = new SqlParameter();
                    oblogin.ParameterName = "@message";
                    oblogin.SqlDbType     = SqlDbType.NVarChar;
                    oblogin.Size          = 50;
                    oblogin.Direction     = ParameterDirection.Output;
                    cmd.Parameters.Add(oblogin);
                    con.Open();
                    cmd.ExecuteNonQuery();
                    res = Convert.ToString(oblogin.Value);
                    con.Close();
                    return(res);
                }
            }
            catch (Exception ex)
            {
                res = ex.Message;
            }
            return(res);
        }
        protected void bindReport()
        {
            List <Leads> objLead   = null;
            var          predicate = PredicateBuilder.True <CRM.Data.Entities.Leads>();

            if (Cache["FromDate"] != null && Cache["FromDate"].ToString() != "")
            {
                DateTime sDate = new DateTime(Convert.ToInt32(Cache["FromDate"].ToString().Trim().Substring(6, 4)), Convert.ToInt32(Cache["FromDate"].ToString().Trim().Substring(3, 2)), Convert.ToInt32(Cache["FromDate"].ToString().Trim().Substring(0, 2)));

                var datefrom = Convert.ToDateTime(sDate);
                predicate = predicate.And(Lead => Lead.DateSubmitted >= datefrom
                                          );
            }
            if (Cache["ToDate"] != null && Cache["ToDate"].ToString() != "")
            {
                DateTime sDate = new DateTime(Convert.ToInt32(Cache["ToDate"].ToString().Trim().Substring(6, 4)), Convert.ToInt32(Cache["ToDate"].ToString().Trim().Substring(3, 2)), Convert.ToInt32(Cache["ToDate"].ToString().Trim().Substring(0, 2)));

                var dateto = Convert.ToDateTime(sDate);
                predicate = predicate.And(Lead => Lead.DateSubmitted <= dateto
                                          );
            }
            if (Cache["Criteria"] != null && Cache["Criteria"].ToString() != "")
            {
                var user = Cache["Criteria"].ToString();
                predicate = predicate.And(Lead => Lead.SecUser.UserName == user);
            }
            objLead = LeadsManager.GetPredicate(predicate);

            List <AllUserLeads> resAllUserLeads    = new List <AllUserLeads>();
            AllUserLeads        objAllUserLeadsGet = null;

            foreach (var get in objLead)
            {
                objAllUserLeadsGet = new AllUserLeads();


                objAllUserLeadsGet.LeadId   = get.LeadId;
                objAllUserLeadsGet.UserId   = (int)get.UserId;
                objAllUserLeadsGet.UserName = get.SecUser.UserName;
                //objAllUserLeadsGet.DateSubmitted = (DateTime?)get.DateSubmitted;
                objAllUserLeadsGet.DateSubmitted = get.DateSubmitted == null ? "" : Convert.ToDateTime(get.DateSubmitted).ToString("dd/MMM/yy");
                objAllUserLeadsGet.LFUUID        = get.LFUUID;
                //objAllUserLeadsGet.OriginalLeadDate = (DateTime)get.OriginalLeadDate;
                objAllUserLeadsGet.OriginalLeadDate = get.OriginalLeadDate == null ? "" : Convert.ToDateTime(get.OriginalLeadDate).ToString("dd/MMM/yy");
                objAllUserLeadsGet.ClaimsNumber     = get.ClaimsNumber == null ? 0 : (int)get.ClaimsNumber;
                //objAllUserLeadsGet.ClaimantName = get.ClaimantName;
                objAllUserLeadsGet.ClaimantName = get.ClaimantFirstName + get.ClaimantLastName;

                //if (get.LeadSourceMaster != null)
                //	objAllUserLeadsGet.LeadStatus = get.LeadSourceMaster.LeadSourceName == null ? "" : get.LeadSourceMaster.LeadSourceName;

                objAllUserLeadsGet.EmailAddress = get.EmailAddress;

                //if (get.AdjusterMaster != null)
                //	objAllUserLeadsGet.Adjuster = get.AdjusterMaster.AdjusterName == null ? "" : get.AdjusterMaster.AdjusterName;
                ////objAllUserLeadsGet.LeadSource = get.LeadSource;

                if (get.LeadSourceMaster != null)
                {
                    objAllUserLeadsGet.LeadSource = get.LeadSourceMaster.LeadSourceName == null ? "" : get.LeadSourceMaster.LeadSourceName;
                }

                if (get.PrimaryProducerId != null)
                {
                    objAllUserLeadsGet.PrimaryProducerId = (int)get.PrimaryProducerId;
                }

                if (get.ProducerMaster != null)
                {
                    objAllUserLeadsGet.PrimaryProducerName = get.ProducerMaster.ProducerName;
                }

                objAllUserLeadsGet.SecondaryProducerId = (int)(get.SecondaryProducerId ?? 0);
                //objAllUserLeadsGet.SecondaryProducerName = get.ProducerMaster1.ProducerName;

                if (get.SecondaryProducerMaster != null)
                {
                    objAllUserLeadsGet.SecondaryProducerName = get.SecondaryProducerMaster.SecondaryProduceName == null ? "" : get.SecondaryProducerMaster.SecondaryProduceName;
                }

                objAllUserLeadsGet.EmailAddress = get.EmailAddress;

                if (get.InspectorMaster != null)
                {
                    objAllUserLeadsGet.InspectorName = get.InspectorMaster.InspectorName == null ? "" : get.InspectorMaster.InspectorName;
                }

                objAllUserLeadsGet.InspectorCell  = get.InspectorCell;
                objAllUserLeadsGet.InspectorEmail = get.InspectorEmail;
                objAllUserLeadsGet.PhoneNumber    = get.PhoneNumber;

                //if (get.WebformSourceMaster != null)
                //	objAllUserLeadsGet.WebformSource = get.WebformSourceMaster.WebformSource == null ? "" : get.WebformSourceMaster.WebformSource;

                objAllUserLeadsGet.ClaimantComments = get.ClaimantComments;
                //objAllUserLeadsGet.TypeOfDamage = get.TypeOfDamageMaster.TypeOfDamage == null ? "" : get.TypeOfDamageMaster.TypeOfDamage;
                objAllUserLeadsGet.TypeOfDamage = get.TypeofDamageText == null ? "" : get.TypeofDamageText;
                //objAllUserLeadsGet.TypeOfProperty = (int)get.TypeOfProperty;
                //objAllUserLeadsGet.TypeOfProperty = get.TypeOfProperty == 1 ? "Home" : "Hotel";

                if (get.TypeOfPropertyMaster != null)
                {
                    objAllUserLeadsGet.TypeOfProperty = get.TypeOfPropertyMaster.TypeOfProperty == null ? "" : get.TypeOfPropertyMaster.TypeOfProperty;
                }

                //objAllUserLeadsGet.ReporterToInsurer = get.ReporterToInsurer == null ? "NO" : get.ReporterToInsurer.ToString() == "Y" ? "YES" : "NO";
                if (get.ReportedToInsurerMaster != null)
                {
                    objAllUserLeadsGet.ReporterToInsurer = get.ReportedToInsurerMaster.ReportedToInsurer == null ? "" : get.ReportedToInsurerMaster.ReportedToInsurer;
                }

                resAllUserLeads.Add(objAllUserLeadsGet);
            }



            ListtoDataTableConverter converter = new ListtoDataTableConverter();
            DataTable dt      = converter.ToDataTable(resAllUserLeads);
            string    xmlpath = Request.MapPath("~/Protected/Reports") + "/AllUserLeads.xml";

            dt.WriteXml(xmlpath);


            if (dt != null && dt.Rows.Count > 0)
            {
                ReportDocument RptDoc           = new ReportDocument();
                string         ReportFolderPath = System.Configuration.ConfigurationManager.AppSettings["ReportPath"].ToString();
                RptDoc.Load(Request.MapPath(ReportFolderPath + "crptAllUserLeads1.rpt"));                //CrystalReport1.rpt
                RptDoc.SetDataSource(dt);
                CrystalReportViewer1.ReportSource = RptDoc;
                CrystalReportViewer1.DataBind();
            }
            else
            {
                CrystalReportViewer1.ReportSource = null;
                CrystalReportViewer1.DataBind();
            }
        }
        private void txt_SearchCatalogue_TextChanged(object sender, EventArgs e)
        {
            //QuestionBL questionBL = new QuestionBL();
            //List<DO.Question> ListQuestion = questionBL.GetQuestion();

            QuestionBL QuestionBL = new QuestionBL();
            Catalogue Cat = new Catalogue();
            Cat.IDCatalogue = IDCat;
            List<DO.Question> QuestionList;
            QuestionList = QuestionBL.GetQuestionByCatalogue(Cat);
            //if (QuestionList != null)
                //dgv_Question1.DataSource = QuestionList;
            //loadQuestion();
            ListtoDataTableConverter converter = new ListtoDataTableConverter();
            DataTable dt = converter.ToDataTable(QuestionList);

            dgv_Question1.DataSource = dt;
            dt.DefaultView.RowFilter = string.Format("NameQuestion LIKE '%{0}%' or TypeQuestion LIKE '%{0}%' or NameCatalogue LIKE '%{0}%' or QuestionTitle LIKE '%{0}%'or Sequence LIKE '%{0}%'", txt_SearchCatalogue.Text);

            dgv_Question1.Columns["IDCatalogue"].Visible = false;
            dgv_Question1.Columns["IDQuestion"].Visible = false;
            dgv_Question1.Columns["IDCatalogue"].Visible = false;
            dgv_Question1.Columns["AnswerContent"].Visible = false;
            dgv_Question1.Columns["AnswerList"].Visible = false;
            dgv_Question1.Columns["Date"].Visible = false;

            dgv_Question1.Columns["Sequence"].HeaderText = "STT";
            dgv_Question1.Columns["NameQuestion"].HeaderText = "Tên Câu Hỏi";
            dgv_Question1.Columns["NameCatalogue"].HeaderText = "Tên chủ Đề";
            dgv_Question1.Columns["TypeQuestion"].HeaderText = "Loại Câu hỏi";

            dgv_Question1.Columns["Sequence"].ReadOnly = true;
            dgv_Question1.Columns["NameQuestion"].ReadOnly = false;
            dgv_Question1.Columns["NameCatalogue"].ReadOnly = true;
            dgv_Question1.Columns["TypeQuestion"].ReadOnly = true;

            dgv_Question1.Columns["Sequence"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgv_Question1.Columns["NameCatalogue"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
            dgv_Question1.Columns["TypeQuestion"].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells;
        }
Exemple #16
0
        public JsonResult CreateTranExit(TranExitModel objTranExitModel, TranExitDissatisfactionModel objDissatisfaction, TranExitAnotherJobModel objAnotherJob, TRANEXITFORMSUPERVISORModel objSupervisor, TRANEXITFORMORGANIZATIONASPECTSModel objOrganization, TRANEXITFORMJOBASPECTSModel objJobAspect)
        {
            //TRANEXITFORMSUPERVISORModel objSupervisor, TRANEXITFORMORGANIZATIONASPECTSModel objOrganization, TRANEXITFORMJOBASPECTSModel objJobAspect
            List <TranExitModel> TranExitlist = new List <TranExitModel>();

            TranExitlist.Add(objTranExitModel);
            ListtoDataTableConverter converter = new ListtoDataTableConverter();
            DataTable dt = new DataTable();

            dt = converter.ToDataTable(TranExitlist);

            List <TranExitDissatisfactionModel> DissatisfactionList = new List <TranExitDissatisfactionModel>();

            DissatisfactionList.Add(objDissatisfaction);
            ListtoDataTableConverter disstatisfactionConverter = new ListtoDataTableConverter();
            DataTable dt1 = new DataTable();

            dt1 = disstatisfactionConverter.ToDataTable(DissatisfactionList);

            List <TranExitAnotherJobModel> AnotherJobList = new List <TranExitAnotherJobModel>();

            AnotherJobList.Add(objAnotherJob);
            ListtoDataTableConverter anotherjobConverter = new ListtoDataTableConverter();
            DataTable dt2 = new DataTable();

            dt2 = anotherjobConverter.ToDataTable(AnotherJobList);

            List <TRANEXITFORMSUPERVISORModel> SupervisorList = new List <TRANEXITFORMSUPERVISORModel>();

            SupervisorList.Add(objSupervisor);
            ListtoDataTableConverter SupervisorConverter = new ListtoDataTableConverter();
            DataTable dt3 = new DataTable();

            dt3 = SupervisorConverter.ToDataTable(SupervisorList);

            List <TRANEXITFORMORGANIZATIONASPECTSModel> OrganizationList = new List <TRANEXITFORMORGANIZATIONASPECTSModel>();

            OrganizationList.Add(objOrganization);
            ListtoDataTableConverter OrgConverter = new ListtoDataTableConverter();
            DataTable dt4 = new DataTable();

            dt4 = OrgConverter.ToDataTable(OrganizationList);

            List <TRANEXITFORMJOBASPECTSModel> JobAspectList = new List <TRANEXITFORMJOBASPECTSModel>();

            JobAspectList.Add(objJobAspect);
            ListtoDataTableConverter JobAspectConverter = new ListtoDataTableConverter();
            DataTable dt5 = new DataTable();

            dt5 = JobAspectConverter.ToDataTable(JobAspectList);

            MastersModel mm  = new MastersModel();
            string       res = "";

            try
            {
                res = tedb_layer.CreateTranExit(dt, dt1, dt2, dt3, dt4, dt5);

                //objTranExitModel, objDissatisfaction, objAnotherJob
                string[] response = res.Split(',');
                if (response[0] == "Success")
                {
                    mm.SuccessMsg = response[1];
                }
                else if (response[0] == "Error")
                {
                    mm.ErrorMsg = response[1];
                }
                GetExit_id();
            }
            catch (Exception ex)
            {
                mm.ErrorMsg = ex.Message;
            }
            return(Json(mm, JsonRequestBehavior.AllowGet));
        }
Exemple #17
0
        public void Export <T>(List <T> items)
        {
            var dt = ListtoDataTableConverter.ToDataTable(items);

            ExcelHelper.Export(dt, _filePath);
        }