public void LoginWithGoogle(ClassTemp _lop) { lop = _lop.lops; GoogleConnect.ClientId = "520808312902-8b27bsq7b88uvjvse8da3svlbue2sb1v.apps.googleusercontent.com"; GoogleConnect.ClientSecret = "frdbgU0wC677SMYGcxF2zmmP"; GoogleConnect.RedirectUri = Request.Url.AbsoluteUri.Split('?')[0]; GoogleConnect.Authorize("profile", "email"); }
public ActionResult uploadDiem(ClassTemp upload) { if (db.SINHVIENs.Where(x => x.Ma_SV == upload.masv).Count() > 0) { ViewBag.maso = upload.masv + ": " + "Đã tồn tại."; } else { SINHVIEN sv = new SINHVIEN(); sv.Ma_SV = upload.masv; sv.Ma_Lop = upload.lops; sv.Ten_SV = upload.masv; Session["lop"] = upload.lops; Session["email"] = upload.masv; Session["name"] = upload.masv; Session["diachi"] = ""; Session["sdt"] = ""; Session["avata"] = ""; db.SINHVIENs.InsertOnSubmit(sv); db.SubmitChanges(); HttpPostedFileBase excelfile = Request.Files["excelfile"]; if (excelfile.ContentLength == 0 || excelfile == null) { TempData["file"] = "<label style='color: #ff4a4a'>Bạn chưa chọn file điểm.</label>"; return(RedirectToAction("index", "importdata")); } else { if (excelfile.FileName.EndsWith("xls") || excelfile.FileName.EndsWith("xlsx")) { string path = Server.MapPath("~/Content/" + excelfile.FileName); if (System.IO.File.Exists(path)) { System.IO.File.Delete(path); } excelfile.SaveAs(path); Session["path"] = path; //read data from excel file ReadExcel(path); } else { TempData["file"] = "<label style='color: #ff4a4a'>File không đúng định dạng</label>"; } } } ViewBag.thongbao = "thành công"; return(View("index")); }
/// <summary> /// 获取模型列表 /// </summary> /// <param name="modelList"></param> /// <param name="typeList"></param> /// <returns></returns> public ObjectAddList GetObjectAddListEx(List <DevModel> modelList, List <DevType> typeList) { var ModelTypeList = from model in modelList join type in typeList on(model.ModelId + "_前面板_0.png") equals type.FrontElevation into TempTable from c in TempTable.DefaultIfEmpty() where !string.IsNullOrEmpty(model.Items) && !string.IsNullOrEmpty(model.Class) orderby model.Items, model.Class select new ModelTypeItem { Item = model.Items, Class = model.Class, Name = model.Name, nType = c == null ? "0" : c.TypeCode.ToString() }; modelItemDic.Clear(); modelClassDic.Clear(); foreach (var item in ModelTypeList) { InitDic(modelItemDic, item.Item, item); InitDic(modelClassDic, item.Class, item); } ObjectAddList tempList = new ObjectAddList(); foreach (KeyValuePair <string, List <ModelTypeItem> > Items in modelItemDic) { ObjectAddList_Type t = new ObjectAddList_Type(); t.typeName = Items.Key; t.childTypeList = new List <ObjectAddList_ChildType>(); foreach (var item in Items.Value) { ObjectAddList_ChildType t2 = new ObjectAddList_ChildType(); t2.childTypeName = item.Class; List <ModelTypeItem> ClassTemp; modelClassDic.TryGetValue(item.Class, out ClassTemp); if (ClassTemp != null && ClassTemp.Count != 0) { t2.modelList = new List <ObjectAddList_Model>(); List <ModelTypeItem> modelListTemp = new List <ModelTypeItem>(); foreach (var model in ClassTemp) { if (model.Item != t.typeName) { continue; //同一个大类的模型,可能不属于同一个大项 } modelListTemp.Add(model); } foreach (var model in modelListTemp) { ObjectAddList_Model modelT = new ObjectAddList_Model(); modelT.modelName = model.Name; modelT.typeCode = model.nType; t2.modelList.Add(modelT); ClassTemp.Remove(model); } t.childTypeList.Add(t2); } } tempList.Add(t); } tempList = tempList.Count == 0 ? null : tempList; return(tempList); }