internal static IPurchaseOrderTemplate CreateEmailMessage(SPListItem _item, EntitiesDataContext _EDC) { try { EscortPO _fpo = (from idx in _EDC.EscortPOLibrary where idx.Id == _item.ID select idx).First(); return(new SecurityEscortPurchaseOrderTemplate() { SPOFreightPO = _fpo.SPOFreightPO.NotAvailable(), EmaiAddressTo = _fpo.EmailAddress.NotAvailable(), Encodedabsurl = new Uri((string)_item["EncodedAbsUrl"]), Modified = (DateTime)_item["Modified"], ModifiedBy = ((string)_item["Editor"]).NotAvailable(), DocumentName = _item.File.Name.NotAvailable(), SPO2CityTitle = _fpo.SecurityPOCity.NotAvailable(), SPO2CommodityTitle = _fpo.SecurityPOCommodity.NotAvailable(), SPO2CountryTitle = _fpo.SecurityPOCountry.NotAvailable(), SPODispatchDate = _fpo.SPODispatchDate.GetValueOrDefault(DateTime.MaxValue), FPO2WarehouseAddress = _fpo.FPOWarehouseAddress.NotAvailable(), }); } catch (Exception ex) { string _frmt = "Worflow aborted in CreateEmailMessage because of error: {0}"; throw new ApplicationException(String.Format(_frmt, ex.Message)); } }
public static bool delete(ChiTietHoaDonNXB chitiet) { try { using (EntitiesDataContext db = new EntitiesDataContext()) { CHITIETHOADONNXB ct; ct = (from c in db.CHITIETHOADONNXBs where c.masohoadon.Equals(chitiet.MaSoHoaDon) && c.masosach.Equals(chitiet.MaSoSach) select c).SingleOrDefault(); if (ct == null) { return(false); } db.CHITIETHOADONNXBs.DeleteOnSubmit(ct); db.SubmitChanges(); return(true); } } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public static List <HoaDonNXB> findBy(Dictionary <string, dynamic> Params) { using (EntitiesDataContext db = new EntitiesDataContext()) { dynamic value; var linqQuery = getAll() .Where(hd => hd.MaSoHoaDon.Equals( Params.TryGetValue(Properties.MaSoHoaDon, out value) ? value as int? : hd.MaSoHoaDon )).Where(hd => hd.MaSoNXB.Equals( Params.TryGetValue(Properties.MaSoNXB, out value) ? value as int? : hd.MaSoNXB )).Where(hd => hd.NgayLap.Equals( Params.TryGetValue(Properties.NgayLap, out value) ? value as DateTime? : hd.NgayLap )).Where(hd => hd.TongTien.Equals( Params.TryGetValue(Properties.MaSoHoaDon, out value) ? value as decimal? : hd.TongTien )).Where(hd => hd.TrangThai.Equals( Params.TryGetValue(Properties.TrangThai, out value) ? value as int? : hd.TrangThai )); return(linqQuery.ToList()); } }
public static bool add(ChiTietHoaDonNXB chitiet, int masohoadon) { try { using (EntitiesDataContext db = new EntitiesDataContext()) { CHITIETHOADONNXB ct; ct = (from c in db.CHITIETHOADONNXBs where c.masohoadon.Equals(masohoadon) && c.masosach.Equals(chitiet.MaSoSach) select c).SingleOrDefault(); if (ct != null) { return(false); } ct = new CHITIETHOADONNXB { masohoadon = masohoadon, masosach = chitiet.MaSoSach, soluong = chitiet.SoLuong, dongia = chitiet.DonGia, trangthai = chitiet.TrangThai == null ? 0 : 1 }; db.CHITIETHOADONNXBs.InsertOnSubmit(ct); db.SubmitChanges(); return(true); } } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public static bool delete(int masohoadon) { try { using (EntitiesDataContext db = new EntitiesDataContext()) { HOADONNXB hd; hd = (from p in db.HOADONNXBs where p.masohoadon.Equals(masohoadon) select p).SingleOrDefault(); if (hd == null) { return(false); } db.CHITIETHOADONNXBs.DeleteAllOnSubmit(hd.CHITIETHOADONNXBs); db.HOADONNXBs.DeleteOnSubmit(hd); db.SubmitChanges(); return(true); } } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public static int add(HoaDonNXB hoadon) { try { using (EntitiesDataContext db = new EntitiesDataContext()) { var hd = new HOADONNXB { masonxb = hoadon.MaSoNXB, ngaylap = hoadon.NgayLap, tongtien = hoadon.ChiTiet.Sum(ct => ct.SoLuong * ct.DonGia), trangthai = 0 }; db.HOADONNXBs.InsertOnSubmit(hd); db.SubmitChanges(); foreach (ChiTietHoaDonNXB ct in hoadon.ChiTiet) { ChiTiet.add(ct, hd.masohoadon); } return(hd.masohoadon); } } catch (Exception ex) { Console.WriteLine(ex.Message); return(0); } }
public static bool edit(CongNoDaiLy congno) { try { using (EntitiesDataContext db = new EntitiesDataContext()) { CONGNODAILY cn; cn = (from d in db.CONGNODAILies where d.masodaily.Equals(congno.MaSoDaiLy) && d.masosach.Equals(congno.MaSoSach) && d.thang.Month.Equals(congno.Thang.Month) && d.thang.Year.Equals(congno.Thang.Year) select d).SingleOrDefault(); if (cn == null) { return(false); //Nếu đại lý không tồn tại } cn.soluong = congno.SoLuong; cn.dongia = congno.DonGia; db.SubmitChanges(); return(true); } } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public static List <ChiTietPhieuNhap> findBy(Dictionary <string, dynamic> Params) { using (EntitiesDataContext db = new EntitiesDataContext()) { dynamic value; var linqQuery = getAll() .Where(chitiet => chitiet.MaSoPhieuNhap.Equals( Params.TryGetValue(Properties.MaSoPhieuNhap, out value) ? value as int? : chitiet.MaSoPhieuNhap )).Where(chitiet => chitiet.MaSoSach.Equals( Params.TryGetValue(Properties.MaSoSach, out value) ? value as int? : chitiet.MaSoSach )).Where(chitiet => chitiet.SoLuong.Equals( Params.TryGetValue(Properties.SoLuong, out value) ? value as decimal? : chitiet.SoLuong )).Where(chitiet => chitiet.DonGia.Equals( Params.TryGetValue(Properties.DonGia, out value) ? value as decimal? : chitiet.DonGia )).Where(chitiet => chitiet.TrangThai.Equals( Params.TryGetValue(Properties.TrangThai, out value) ? value as int? : chitiet.TrangThai )); return(linqQuery.ToList()); } }
public static List <DaiLy> findBy(Dictionary <string, dynamic> Params) { using (EntitiesDataContext db = new EntitiesDataContext()) { dynamic value; var linqQuery = getAll() .Where(d => d.MaSoDaiLy.Equals( Params.TryGetValue(Properties.MaSoDaiLy, out value) ? value as int? : d.MaSoDaiLy )).Where(d => d.TenDaiLy.Equals( Params.TryGetValue(Properties.TenDaiLy, out value) ? value as string : d.TenDaiLy )).Where(d => d.DiaChi.Equals( Params.TryGetValue(Properties.DiaChi, out value) ? value as string : d.DiaChi )).Where(d => d.SoDienThoai.Equals( Params.TryGetValue(Properties.SoDienThoai, out value) ? value as string : d.SoDienThoai )).Where(d => d.SoTaiKhoan.Equals( Params.TryGetValue(Properties.SoTaiKhoan, out value) ? value as string : d.SoTaiKhoan )).Where(d => d.TrangThai.Equals( Params.TryGetValue(Properties.TrangThai, out value) ? value as int? : d.TrangThai )).Where(d => d.MaSoNguoiDung.Equals( Params.TryGetValue(Properties.MaSoNguoiDung, out value) ? value as int? : d.MaSoNguoiDung )); return(linqQuery.ToList()); } }
public static bool delete(CongNoNXB congno) { try { using (EntitiesDataContext db = new EntitiesDataContext()) { CONGNONXB cn; cn = (from d in db.CONGNONXBs where d.masonxb.Equals(congno.MaSoNXB) && d.masosach.Equals(congno.MaSoSach) && d.thang.Month.Equals(congno.Thang.Month) && d.thang.Year.Equals(congno.Thang.Year) select d).SingleOrDefault(); if (cn == null) { return(false); //Nếu đại lý không tồn tại } db.CONGNONXBs.DeleteOnSubmit(cn); db.SubmitChanges(); return(true); } } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
internal static void SetupConnections(EntitiesDataContext _edc, SPWeb _root) { SPFile file = _root.GetFile(URLVendorDashboard); System.Collections.Generic.Dictionary <string, WebPart> _dict = new System.Collections.Generic.Dictionary <string, WebPart>(); Anons.WriteEntry(_edc, m_SourceClass + m_SourceSetupConnections, "Setup connections starting"); string _phase = "starting"; using (SPLimitedWebPartManager _pageMgr = file.GetLimitedWebPartManager(PersonalizationScope.Shared)) try { _dict = _pageMgr.WebParts.Cast <WebPart>().ToDictionary(key => key.ID); //.ForEach(wp => wpMgr.DeleteWebPart(wp)); _phase = "After wpMgr.WebParts.Cast"; ConnectWebParts ( _pageMgr, _dict[IDCurrentUser], _dict[IDCarrierDashboardWebPart], CurrentUserWebPart.CurrentUserWebPart.CurrentUserProviderPoint, CarrierDashboard.CarrierDashboardWebPart.CarrierDashboardWebPart.ConsumertIDPartnerInterconnection ); } catch (Exception ex) { StringBuilder _names = new StringBuilder(); _dict.Keys.ToList <string>().ForEach(name => _names.Append(name + ", ")); string _msg = String.Format("Setup connections failed in Phase={0}, Count={1}, First={2}, Ex={3}", _phase, _dict.Count, _names.ToString(), ex.Message); Anons.WriteEntry(_edc, m_SourceClass + m_SourceSetupConnections, _msg); //throw new ApplicationException(_msg); } Anons.WriteEntry(_edc, m_SourceClass + m_SourceSetupConnections, "Setup connections finished"); }
internal UserDescriptor(SPUser _user) : this() { DataRow row = this.NewRow(); row[_EmailColumnName] = _user.Email; row[_IDColumnName] = _user.ID; row[_LoginNameColumnName] = _user.LoginName; row[_NameColumnName] = this.User = _user.Name; using (EntitiesDataContext edc = new EntitiesDataContext(SPContext.Current.Web.Url)) { Partner _Partner = Partner.FindForUser(edc, _user); if (_Partner != null) { row[_CompanyIDColumnName] = _Partner.Id.ToString(); row[_CompanyTitleColumnName] = Company = _Partner.Title; } else { row[_CompanyIDColumnName] = String.Empty; row[_CompanyTitleColumnName] = String.Empty; } } this.Rows.Add(row); Schema = TypeDescriptor.GetProperties(this.Row0); }
private void RequestData(TimeSpan _delay, Shipping _sp, AlarmPriority _pr, EntitiesDataContext EDC, bool _TimeOutExpired) { string _frmt = "RequestDataTrucktrailerDrivers".GetLocalizedString(); _frmt = String.Format(_frmt, _delay, DateTime.Now + _delay); Shipping.RequiredOperations _ro = 0; switch (_pr) { case AlarmPriority.Normal: _ro = _sp.CalculateOperations2Do(false, true, _TimeOutExpired); _frmt.Insert(0, "Remainder".GetLocalizedString()); break; case AlarmPriority.High: _ro = _sp.CalculateOperations2Do(true, true, _TimeOutExpired); _frmt.Insert(0, "LastCall".GetLocalizedString()); break; case AlarmPriority.Warning: _ro = _sp.CalculateOperations2Do(false, true, _TimeOutExpired); _frmt.Insert(0, "Warnning".GetLocalizedString()); break; case AlarmPriority.None: case AlarmPriority.Invalid: default: break; } SetupEnvironment(_delay, _ro, _sp, _pr, EDC, _frmt, EmailType.RequestData); }
private void CreateTimeSlots(EntitiesDataContext _EDC, ShippingPoint _sp, UpdateToolStripEvent _update) { _update(this, new ProgressChangedEventArgs(1, "CreateTimeSlots starting")); for (int _i = 0; _i < Properties.Settings.Default.NumberOfDays; _i++) { DateTime _dy = DateTime.Now.Date + TimeSpan.FromDays(_i); _update(this, new ProgressChangedEventArgs(1, _dy.ToShortDateString())); if (_dy.DayOfWeek == DayOfWeek.Sunday || _dy.DayOfWeek == DayOfWeek.Saturday) { continue; } List <TimeSlotTimeSlot> _ts = new List <TimeSlotTimeSlot>(); short _strtTm = 8; for (int _indx = _strtTm; _indx <= _strtTm + Properties.Settings.Default.TimeSlotsPerDay; _indx++) { DateTime _bgn = _dy + TimeSpan.FromHours(_indx); DateTime _end = _bgn + TimeSpan.FromHours(1); _ts.Add(new TimeSlotTimeSlot() { EntryTime = _bgn, EndTime = _end, ExitTime = _end, Occupied = Occupied.Free, TimeSlot2ShippingPointLookup = _sp, StartTime = _bgn }); _update(this, new ProgressChangedEventArgs(1, _bgn.ToShortDateString())); } _EDC.TimeSlot.InsertAllOnSubmit(_ts); _EDC.SubmitChanges(); } }
public static int add(DaiLy daily) { try { using (EntitiesDataContext db = new EntitiesDataContext()) { DAILY dl; dl = (from d in db.DAILies where d.masodaily.Equals(daily.MaSoDaiLy) select d).SingleOrDefault(); if (dl != null) { return(0); //Nếu đại lý đã tồn tại } dl = new DAILY() { ten = daily.TenDaiLy, diachi = daily.DiaChi, sodienthoai = daily.SoDienThoai, sotaikhoan = daily.SoTaiKhoan, nganhang = daily.NganHang, masonguoidung = daily.MaSoNguoiDung }; db.DAILies.InsertOnSubmit(dl); db.SubmitChanges(); return(dl.masodaily); } } catch (Exception ex) { Console.WriteLine(ex.Message); return(0); } }
public static bool delete(int masodaily) { try { using (EntitiesDataContext db = new EntitiesDataContext()) { DAILY dl; dl = (from d in db.DAILies where d.masodaily.Equals(masodaily) select d).SingleOrDefault(); if (dl == null) { return(false); //Nếu đại lý không tồn tại } db.DAILies.DeleteOnSubmit(dl); db.SubmitChanges(); return(true); } } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public static bool add(ChiTietPhieuNhap chitiet, int masophieunhap) { try { using (EntitiesDataContext db = new EntitiesDataContext()) { CHITIETPHIEUNHAP ct; ct = (from c in db.CHITIETPHIEUNHAPs where c.masophieunhap.Equals(masophieunhap) && c.masosach.Equals(chitiet.MaSoSach) select c).SingleOrDefault(); if (ct != null) { return(false); } ct = new CHITIETPHIEUNHAP() { masosach = chitiet.Sach.MaSoSach, dongia = chitiet.DonGia, soluong = chitiet.SoLuong, masophieunhap = masophieunhap, trangthai = chitiet.TrangThai == null ? 0 : 1 }; db.CHITIETPHIEUNHAPs.InsertOnSubmit(ct); db.SubmitChanges(); return(true); } }catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public static bool add(List <ChiTietPhieuNhap> dmchitiet, int masophieunhap) { try { using (EntitiesDataContext db = new EntitiesDataContext()) { foreach (ChiTietPhieuNhap chitiet in dmchitiet) { CHITIETPHIEUNHAP ct = new CHITIETPHIEUNHAP() { masosach = chitiet.Sach.MaSoSach, dongia = chitiet.DonGia, soluong = chitiet.SoLuong, masophieunhap = masophieunhap, trangthai = 0 }; db.CHITIETPHIEUNHAPs.InsertOnSubmit(ct); } db.SubmitChanges(); return(true); } } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public static bool delete(int masophieunhap) { try { using (EntitiesDataContext db = new EntitiesDataContext()) { PHIEUNHAP phieu; phieu = (from p in db.PHIEUNHAPs where p.masophieunhap.Equals(masophieunhap) select p).SingleOrDefault(); if (phieu == null) { return(false); } db.CHITIETPHIEUNHAPs.DeleteAllOnSubmit(phieu.CHITIETPHIEUNHAPs); db.PHIEUNHAPs.DeleteOnSubmit(phieu); db.SubmitChanges(); return(true); } } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public static bool edit(HoaDonNXB hoadon) { try { using (EntitiesDataContext db = new EntitiesDataContext()) { HOADONNXB hd; hd = (from p in db.HOADONNXBs where p.masohoadon.Equals(hoadon.MaSoHoaDon) select p).SingleOrDefault(); if (hd == null) { return(false); } hd.masonxb = hoadon.MaSoNXB; hd.ngaylap = hoadon.NgayLap; hd.trangthai = hoadon.TrangThai; hd.tongtien = hoadon.ChiTiet.Sum(ct => ct.SoLuong * ct.DonGia); // tính tổng tiền các chi tiết db.CHITIETHOADONNXBs.DeleteAllOnSubmit(hd.CHITIETHOADONNXBs); db.SubmitChanges(); foreach (ChiTietHoaDonNXB ct in hoadon.ChiTiet) { ChiTiet.add(ct, hoadon.MaSoHoaDon); } return(true); } } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public static bool edit(PhieuNhap phieu) { try { using (EntitiesDataContext db = new EntitiesDataContext()) { PHIEUNHAP px; px = (from p in db.PHIEUNHAPs where p.masophieunhap.Equals(phieu.MaSoPhieuNhap) select p).SingleOrDefault(); if (px == null) { return(false); } px.masonxb = phieu.MaSoNXB; px.ngaylap = phieu.NgayLap; px.nguoigiaosach = phieu.NguoiGiao; px.trangthai = phieu.TrangThai; px.tongtien = phieu.ChiTiet.Sum(ct => ct.SoLuong * ct.DonGia); // tính tổng tiền các chi tiết db.CHITIETPHIEUNHAPs.DeleteAllOnSubmit(px.CHITIETPHIEUNHAPs); db.SubmitChanges(); foreach (ChiTietPhieuNhap ct in phieu.ChiTiet) { ct.MaSoPhieuNhap = phieu.MaSoPhieuNhap; ChiTiet.add(ct); } return(true); } } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public static int add(PhieuNhap phieunhap) { try { using (EntitiesDataContext db = new EntitiesDataContext()) { var phieu = new PHIEUNHAP() { masonxb = phieunhap.NXB.MaSoNXB, ngaylap = phieunhap.NgayLap, nguoigiaosach = phieunhap.NguoiGiao, tongtien = phieunhap.ChiTiet.Sum(ct => ct.SoLuong * ct.DonGia), trangthai = 0 }; db.PHIEUNHAPs.InsertOnSubmit(phieu); db.SubmitChanges(); ChiTiet.add(phieunhap.ChiTiet, phieu.masophieunhap); return(phieu.masophieunhap); } }catch (Exception ex) { Console.WriteLine(ex.Message); return(0); } }
public static bool delete(int masonguoidung) { try { using (EntitiesDataContext db = new EntitiesDataContext()) { NGUOIDUNG nguoidung; nguoidung = (from s in db.NGUOIDUNGs where s.masonguoidung.Equals(masonguoidung) select s).SingleOrDefault(); if (nguoidung == null) { return(false); } db.NGUOIDUNGs.DeleteOnSubmit(nguoidung); db.SubmitChanges(); return(true); } } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
public static List <CongNoNXB> findBy(Dictionary <string, dynamic> Params) { using (EntitiesDataContext db = new EntitiesDataContext()) { dynamic value; var linqQuery = getAll() .Where(cn => cn.MaSoSach.Equals( Params.TryGetValue(Properties.MaSoSach, out value) ? value as int? : cn.MaSoSach )).Where(cn => cn.MaSoNXB.Equals( Params.TryGetValue(Properties.MaSoNXB, out value) ? value as int? : cn.MaSoNXB )).Where(cn => cn.SoLuong.Equals( Params.TryGetValue(Properties.SoLuong, out value) ? value as decimal? : cn.SoLuong )).Where(cn => cn.DonGia.Equals( Params.TryGetValue(Properties.DonGia, out value) ? value as decimal? : cn.DonGia )).Where(cn => cn.Thang.Equals( Params.TryGetValue(Properties.Thang, out value) ? value as DateTime? : cn.Thang )); return(linqQuery.ToList()); } }
public static bool delete(ChiTietPhieuNhap chitiet) { try { using (EntitiesDataContext db = new EntitiesDataContext()) { CHITIETPHIEUNHAP ct; ct = (from c in db.CHITIETPHIEUNHAPs where c.masophieunhap.Equals(chitiet.MaSoPhieuNhap) && c.masosach.Equals(chitiet.MaSoSach) select c).SingleOrDefault(); if (ct == null) { return(false); } db.CHITIETPHIEUNHAPs.DeleteOnSubmit(ct); db.SubmitChanges(); return(true); } } catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
/// <summary> /// Default constructor. /// </summary> protected DataManagerBase() { if (Context == null) { Context = new EntitiesDataContext(); } }
public static List <PhieuNhap> findBy(Dictionary <string, dynamic> Params) { using (EntitiesDataContext db = new EntitiesDataContext()) { dynamic value; var linqQuery = getAll() .Where(phieu => phieu.MaSoPhieuNhap.Equals( Params.TryGetValue(Properties.MaSoPhieuNhap, out value) ? value as int? : phieu.MaSoPhieuNhap )).Where(phieu => phieu.NguoiGiao.Equals( Params.TryGetValue(Properties.NguoiGiao, out value) ? value as string : phieu.NguoiGiao )).Where(phieu => phieu.NgayLap.Equals( Params.TryGetValue(Properties.NgayLap, out value) ? value as DateTime? : phieu.NgayLap )).Where(phieu => phieu.TongTien.Equals( Params.TryGetValue(Properties.TongTien, out value) ? value as decimal? : phieu.TongTien )).Where(phieu => phieu.MaSoNXB.Equals( Params.TryGetValue(Properties.MaSoNXB, out value) ? value as int? : phieu.MaSoNXB )).Where(phieu => phieu.TrangThai.Equals( Params.TryGetValue(Properties.TrangThai, out value) ? value as int? : phieu.TrangThai )); return(linqQuery.ToList()); } }
public static bool edit(DaiLy daily) { try { using (EntitiesDataContext db = new EntitiesDataContext()) { DAILY dl; dl = (from d in db.DAILies where d.masodaily.Equals(daily.MaSoDaiLy) select d).SingleOrDefault(); if (dl == null) { return(false); //Nếu đại lý không tồn tại } dl.ten = daily.TenDaiLy; dl.diachi = daily.DiaChi; dl.sodienthoai = daily.SoDienThoai; dl.sotaikhoan = daily.SoTaiKhoan; dl.trangthai = daily.TrangThai; dl.nganhang = daily.NganHang; db.SubmitChanges(); return(true); } }catch (Exception ex) { Console.WriteLine(ex.Message); return(false); } }
private static void DeleteWebParts(EntitiesDataContext _edc, SPWeb _root) { Anons.WriteEntry(_edc, m_SourceClass + m_SourceDeleteWebParts, "Delete Web Parts strating"); try { SPList _wpl = _root.GetCatalog(SPListTemplateType.WebPartCatalog); List <SPFile> _filesToDelete = new List <SPFile>(); // figure out which Web Part template files need to be deleted Anons.WriteEntry ( _edc, m_SourceClass + m_SourceDeleteWebParts, String.Format("Processing of the WebPartCatalog containing {0} items starting ", _wpl.ItemCount) ); foreach (SPListItem _li in _wpl.Items) { bool _delete = _li.File.Name.StartsWith("ShepherdDashboards"); if (_delete) { _filesToDelete.Add(_li.File); } string _mess = String.Format("Title: {0}, Name: {1}, File name: {2}, deleted: {3}", _li.Title, _li.Name, _li.File.Name, _delete); Anons.WriteEntry(_edc, "Processing Web Part", _mess); } // delete Web Part template files foreach (SPFile file in _filesToDelete) { file.Delete(); } } catch (Exception ex) { Anons.WriteEntry(_edc, m_SourceClass + m_SourceDeleteWebParts, "Delete Web Parts finished with exception: " + ex.Message); } Anons.WriteEntry(_edc, m_SourceClass + m_SourceDeleteWebParts, "Delete Web Parts finished"); }
protected void Page_Load(object sender, EventArgs e) { SPWeb thisWeb = SPContext.Current.Web; using (EntitiesDataContext ctx = new EntitiesDataContext("http://intranet.contos.com")) { try { var query = from interviews in ctx.Interviews select new { interviews.Title, interviews.Candidate.Name, interviews.Candidate.HomeCity, interviews.InterviewerImnName }; foreach (var item in query) { TreeNode interviewTreeNode = new TreeNode("Interview Details:" + item.Title, null, null, thisWeb.Lists["Interviews"].DefaultViewUrl, "_self"); TreeNode applicantTreeNode = new TreeNode("Applicant:" + item.Name, null, null, thisWeb.Lists["Candidates"].DefaultViewUrl, "_self"); TreeNode homecityTreeNode = new TreeNode("Home City:" + item.HomeCity, null, null, thisWeb.Lists["Candidates"].DefaultViewUrl, "_self"); TreeNode interviewerTreeNode = new TreeNode("SplInterviewer:" + item.InterviewerImnName, null, null, thisWeb.Lists["Interviews"].DefaultViewUrl, "_self"); interviewTreeNode.ChildNodes.Add(applicantTreeNode); interviewTreeNode.ChildNodes.Add(homecityTreeNode); interviewTreeNode.ChildNodes.Add(interviewerTreeNode); TreeView1.Nodes.Add(interviewTreeNode); } } catch (Exception ex) { TreeView1.Nodes.Add(new TreeNode("Err" + ex.Message)); } } }
public static bool IsCompanyNameUnique(this Company company, EntitiesDataContext context) { return context.Companies.Where(c => c.Name == company.Name && c.CompanyId != company.CompanyId).FirstOrDefault() == null; }