コード例 #1
0
ファイル: UserController.cs プロジェクト: dsuljic/ProjectsApp
        // GET: User


        public ActionResult MyProfile(HttpPostedFileBase file)
        {
            ViewBag.Url = "/Images/" + User.Identity.Name + "_profile.jpg";
            DAL       dal = new Models.DAL();
            UserModel um  = dal.getUserById(Convert.ToInt32(CurrentUser.Sid));

            ViewBag.Name        = um.Name;
            ViewBag.Address     = um.Address;
            ViewBag.PhoneNumber = um.PhoneNumber;
            ViewBag.E_mail      = um.E_mail;
            ViewBag.RoleId      = dal.getRoleID(CurrentUser.Role);
            return(View());
        }
コード例 #2
0
ファイル: ARQUIVO.cs プロジェクト: Silas-Siderio/TESTEDADOS
        //PROCEDIMENTO QUE REALIZA A LEITURA DO ARQUIVO
        public void READFILE()
        {
            Models.DAL dal = new Models.DAL();
            string strLine = string.Empty;

            string strarquivo = caminho;

            System.Collections.ArrayList arr = new System.Collections.ArrayList();

            StreamReader sr = new StreamReader(strarquivo, Encoding.GetEncoding("iso-8859-1"));

            while (sr.Peek() >= 0)

            {

                strarquivo = sr.ReadLine();

                arr.Add(strarquivo);

            }

            for (int i = 0; i < arr.Count; i++)

            {

                if (i == 1)

                {
                    string s1 = arr[i].ToString();
                    string t = s1.Length.ToString();
                    string s2 = s1.Substring(0, 11);
                    string s3 = s1.Substring(13, 20);
                    string s4 = s1.Substring(34, 4);
                    string s5 = s1.Substring(39, 1);
                    string s6 = s1.Substring(41, 10);
                    string s7 = s1.Substring(53, 10);

                    dal.GRAVA_VENDA(s2,s3,Convert.ToDecimal(s4),Convert.ToInt16(s5),s6,s7);
                }

                if (i == 2)

                {
                    string s1 = arr[i].ToString();
                    string t = s1.Length.ToString();
                    string s2 = s1.Substring(0, 9);
                    string s3 = s1.Substring(11, 23);
                    string s4 = s1.Substring(35, 4);
                    string s5 = s1.Substring(40, 1);
                    string s6 = s1.Substring(42, 13);
                    string s7 = s1.Substring(56, 19);

                    dal.GRAVA_VENDA(s2, s3, Convert.ToDecimal(s4), Convert.ToInt16(s5), s6, s7);
                }
                if (i == 3)

                {
                    string s1 = arr[i].ToString();
                    string t = s1.Length.ToString();
                    string s2 = s1.Substring(0, 12);
                    string s3 = s1.Substring(13, 21);
                    string s4 = s1.Substring(35, 3);
                    string s5 = s1.Substring(39, 1);
                    string s6 = s1.Substring(41, 11);
                    string s7 = s1.Substring(53, 22);
                    dal.GRAVA_VENDA(s2, s3, Convert.ToDecimal(s4), Convert.ToInt16(s5), s6, s7);
                }

                if (i == 4)

                {
                    string s1 = arr[i].ToString();
                    string t = s1.Length.ToString();
                    string s2 = s1.Substring(0, 15);
                    string s3 = s1.Substring(16, 21);
                    string s4 = s1.Substring(38, 3);
                    string s5 = s1.Substring(42, 1);
                    string s6 = s1.Substring(44, 11);
                    string s7 = s1.Substring(56, 22);

                    dal.GRAVA_VENDA(s2, s3, Convert.ToDecimal(s4), Convert.ToInt16(s5), s6, s7);
                }

            }
        }