Пример #1
0
        public JsonResult GetList(string[] stringArray)
        {
            ViewBag.IsView = true;
            DALExportOwner dalExportOwner = new DALExportOwner();
            BALExportOwner model = new BALExportOwner();
            string filepath = Convert.ToString(Session["FilePathOwner"]);
            model.ItemList = dalExportOwner.getExcelColumnName(filepath);
            List<string> MatchListOfExcel = new List<string>();
            model.ListtblColumnName = (List<string>)Session["DBColumnNameOwner"];
            List<tblColumn> list = new List<tblColumn>();

            MatchListOfExcel.Add("ClientId");
            MatchListOfExcel.Add("Client");
            MatchListOfExcel.Add("NetworkId");
            MatchListOfExcel.Add("Network");
            MatchListOfExcel.Add("PropertyId");
            MatchListOfExcel.Add("Property Address");

            foreach (var item in stringArray)
            {
                MatchListOfExcel.Add(item);
            }

            DataTable dt = dalExportOwner.GetExcelTable(filepath, 0);
            //dalExportOwner.SetMappingField(dt);

            model.dtItem = dalExportOwner.ExportView(dt, MatchListOfExcel.ToArray(), model.ListtblColumnName.ToArray(), filepath);

            foreach (DataRow row in model.dtItem.Rows)
            {
                tblColumn tblColumnObj = new tblColumn();
                tblColumnObj.col1 = Convert.ToString(row[0]);
                tblColumnObj.col2 = Convert.ToString(row[1]);
                tblColumnObj.col3 = Convert.ToString(row[2]);
                tblColumnObj.col4 = Convert.ToString(row[3]);
                tblColumnObj.col5 = Convert.ToString(row[4]);
                tblColumnObj.col6 = Convert.ToString(row[5]);
                tblColumnObj.col7 = Convert.ToString(row[6]);
                tblColumnObj.col8 = Convert.ToString(row[7]);
                tblColumnObj.col9 = Convert.ToString(row[8]);
                tblColumnObj.col10 = Convert.ToString(row[9]);
                tblColumnObj.col11 = Convert.ToString(row[10]);
                tblColumnObj.col12 = Convert.ToString(row[11]);
                tblColumnObj.col13 = Convert.ToString(row[12]);
                tblColumnObj.col14 = Convert.ToString(row[13]);
                tblColumnObj.col15 = Convert.ToString(row[14]);
                tblColumnObj.col16 = Convert.ToString(row[15]);
                tblColumnObj.col17 = Convert.ToString(row[16]);
                tblColumnObj.col18 = Convert.ToString(row[17]);
                tblColumnObj.col19 = Convert.ToString(row[18]);
                tblColumnObj.col20 = Convert.ToString(row[19]);
                tblColumnObj.col21 = Convert.ToString(row[20]);
                tblColumnObj.col22 = Convert.ToString(row[21]);
                tblColumnObj.col23 = Convert.ToString(row[22]);
                tblColumnObj.col24 = Convert.ToString(row[23]);
                list.Add(tblColumnObj);

            }

            return this.Json(list);
        }
Пример #2
0
        public string Save(string[] stringArray)
        {
            try
            {

                DALExportOwner dalExportOwner = new DALExportOwner();
                BALExportProperty model = new BALExportProperty();
                string filepath = Convert.ToString(Session["FilePathOwner"]);
                model.ItemList = dalExportOwner.getExcelColumnName(filepath);

                List<string> MatchListOfExcel = new List<string>();

                model.ListtblColumnName = (List<string>)Session["DBColumnNameOwner"];

                MatchListOfExcel.Add("ClientId");
                MatchListOfExcel.Add("Client");
                MatchListOfExcel.Add("NetworkId");
                MatchListOfExcel.Add("Network");
                MatchListOfExcel.Add("PropertyId");
                MatchListOfExcel.Add("Property Address");

                foreach (var item in stringArray)
                {
                    MatchListOfExcel.Add(item);
                }

                DataTable dt = dalExportOwner.GetExcelTable(filepath, 0);

                model.dtItem = dalExportOwner.ExportView(dt, MatchListOfExcel.ToArray(), model.ListtblColumnName.ToArray(), filepath);

                LoginSession loginsession = (LoginSession)Session["Login"];
                dalExportOwner.AddCreatedById(model.dtItem, loginsession.ClientID);
                SqlParameterOwner sqlParameterOwner = new SqlParameterOwner();
                sqlParameterOwner.ExecuteExportData(model.dtItem);

                return "Import Data Sucessfully.";
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
        }