protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { UPIDataContext db = new UPIDataContext(); List<SchedulePromotion> lst = (from sp in db.SchedulePromotions where sp.IsApprove == true select sp).ToList(); if (lst.Count > 0) { foreach (SchedulePromotion sp in lst) { //if sp.StartDate DateTime.Now; } } } }
public DashboardRepository() { db = new UPIDataContext(); }
public RegionsRepository() { db = new UPIDataContext(); }
public GroupsRepository() { db = new UPIDataContext(); }
public SupervisorManageCustomerRepository() { db = new UPIDataContext(); }
public AdministratorRepository() { db = new UPIDataContext(); }
public AssignFunctionRepository() { db = new UPIDataContext(); }
protected void ddlArea_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) { using (UPIDataContext db = new UPIDataContext()) { GridEditableItem editedItem = (o as RadComboBox).NamingContainer as GridEditableItem; RadComboBox ddlLocation = editedItem["LocationColumn"].FindControl("ddlLocation") as RadComboBox; ddlLocation.DataSource = (from l in db.Locals where l.AreaId == Convert.ToInt32(e.Value) select l); ddlLocation.DataTextField = "LocalName"; ddlLocation.DataValueField = "Id"; ddlLocation.DataBind(); } }
protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e) { if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) { GridEditableItem edititem = (GridEditableItem)e.Item; Hashtable values = new Hashtable(); edititem.ExtractValues(values); using (UPIDataContext db = new UPIDataContext()) { var rowData = (DataRowView)e.Item.DataItem; string sectionIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfSection")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfSection")).Value; string provinceIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfProvince")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfProvince")).Value; string districtIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfDistrict")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfDistrict")).Value; //Section RadComboBox ddlSection = ((RadComboBox)edititem.FindControl("ddlSection")); ddlSection.DataSource = db.Sections; ddlSection.DataTextField = "SectionName"; ddlSection.DataValueField = "Id"; ddlSection.DataBind(); ddlSection.SelectedValue = sectionIndex; // Province RadComboBox ddlprovince = ((RadComboBox)edititem.FindControl("ddlprovince")); ddlprovince.DataSource = (from p in db.Provinces where p.SectionId == int.Parse(ddlSection.SelectedValue) select p); ddlprovince.DataTextField = "ProvinceName"; ddlprovince.DataValueField = "Id"; ddlprovince.DataBind(); ddlprovince.SelectedValue = provinceIndex; //District RadComboBox ddlDistricts = ((RadComboBox)edititem.FindControl("ddlDistricts")); ddlDistricts.DataSource = (from d in db.Districts where d.ProvinceId == int.Parse(ddlprovince.SelectedValue) select d); ddlDistricts.DataTextField = "DistrictName"; ddlDistricts.DataValueField = "Id"; ddlDistricts.DataBind(); ddlDistricts.SelectedValue = districtIndex; // Customer Type RadComboBox comboCustomerType = ((RadComboBox)edititem.FindControl("dropdownCustomerType")); comboCustomerType.DataSource = (from ct in db.CustomerTypes select ct); comboCustomerType.DataTextField = "TypeName"; comboCustomerType.DataValueField = "Id"; comboCustomerType.DataBind(); HiddenField hdfCt = ((HiddenField)edititem.FindControl("hdfCustomerTypeId")); if (hdfCt != null) comboCustomerType.SelectedValue = hdfCt.Value; // Note of Salesmen string noteOfSalesmen = rowData["NoteOfSalesmen"].ToString(); var txtNoteOfSalesmen = ((TextBox)edititem.FindControl("txtNoteOfSalesmen")); txtNoteOfSalesmen.Text = noteOfSalesmen; } } }
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) { GridEditableItem edititem = (GridEditableItem)e.Item; Hashtable values = new Hashtable(); edititem.ExtractValues(values); using (UPIDataContext db = new UPIDataContext()) { //Position RadComboBox ddlPosition = ((RadComboBox)edititem.FindControl("ddlPosition")); ddlPosition.DataSource = db.SupervisorPositions; ddlPosition.DataTextField = "PositionName"; ddlPosition.DataValueField = "Id"; ddlPosition.DataBind(); ddlPosition.SelectedValue = (string)values["PositionId"]; string sectionIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfSection")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfSection")).Value; string provinceIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfProvince")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfProvince")).Value; string districtIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfDistrict")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfDistrict")).Value; //Section RadComboBox ddlSection = ((RadComboBox)edititem.FindControl("ddlSection")); ddlSection.DataSource = db.Sections; ddlSection.DataTextField = "SectionName"; ddlSection.DataValueField = "Id"; ddlSection.DataBind(); ddlSection.SelectedValue = sectionIndex; // Province RadComboBox ddlprovince = ((RadComboBox)edititem.FindControl("ddlprovince")); ddlprovince.DataSource = (from p in db.Provinces where p.SectionId == int.Parse(ddlSection.SelectedValue) select p); ddlprovince.DataTextField = "ProvinceName"; ddlprovince.DataValueField = "Id"; ddlprovince.DataBind(); ddlprovince.SelectedValue = provinceIndex; //District RadComboBox ddlDistrict = ((RadComboBox)edititem.FindControl("ddlDistrict")); ddlDistrict.DataSource = (from d in db.Districts where d.ProvinceId == int.Parse(ddlprovince.SelectedValue) select d); ddlDistrict.DataTextField = "DistrictName"; ddlDistrict.DataValueField = "Id"; ddlDistrict.DataBind(); ddlDistrict.SelectedValue = districtIndex; string custTypeIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfCustomerType")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfCustomerType")).Value; string custIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfCustomer")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfCustomer")).Value; //CustomerType RadComboBox ddlCustomerType = ((RadComboBox)edititem.FindControl("ddlCustomerType")); ddlCustomerType.DataSource = db.CustomerTypes; ddlCustomerType.DataTextField = "TypeName"; ddlCustomerType.DataValueField = "Id"; ddlCustomerType.DataBind(); ddlCustomerType.SelectedValue = custTypeIndex; //Customer RadComboBox ddlCustomers = ((RadComboBox)edititem.FindControl("ddlCustomer")); ddlCustomers.DataSource = (from c in db.Customers where c.CustomerTypeId == (Convert.ToInt32(ddlCustomerType.SelectedValue)) select c); ddlCustomers.DataTextField = "FullName"; ddlCustomers.DataValueField = "Id"; ddlCustomers.DataBind(); ddlCustomers.SelectedValue = custIndex; } } }
public PromotionSearchHistoryRepository() { db = new UPIDataContext(); }
public DistrictsRepository() { db = new UPIDataContext(); }
public ProvincesRepository() { db = new UPIDataContext(); }
public SupervisorPositionRepository() { db = new UPIDataContext(); }
protected void CustomerList_ItemDataBound(object sender, GridItemEventArgs e) { if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) { GridEditableItem edititem = (GridEditableItem)e.Item; Hashtable values = new Hashtable(); edititem.ExtractValues(values); using (UPIDataContext db = new UPIDataContext()) { //CustomerType RadComboBox ddlCustomerType = ((RadComboBox)edititem.FindControl("ddlCustomerType")); ddlCustomerType.DataSource = db.CustomerTypes; ddlCustomerType.DataTextField = "TypeName"; ddlCustomerType.DataValueField = "Id"; ddlCustomerType.DataBind(); ddlCustomerType.SelectedValue = (string)values["CustomerTypeId"]; //Bind data Channel RadComboBox ddlChannels = ((RadComboBox)edititem.FindControl("ddlChannels")); ddlChannels.DataSource = db.Channels; ddlChannels.DataTextField = "ChannelName"; ddlChannels.DataValueField = "Id"; ddlChannels.DataBind(); ddlChannels.SelectedValue = (string)values["ChannelId"]; string sectionIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfSection")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfSection")).Value; string provinceIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfProvince")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfProvince")).Value; string districtIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfDistrict")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfDistrict")).Value; //Section RadComboBox ddlSection = ((RadComboBox)edititem.FindControl("ddlSection")); ddlSection.DataSource = db.Sections; ddlSection.DataTextField = "SectionName"; ddlSection.DataValueField = "Id"; ddlSection.DataBind(); ddlSection.SelectedValue = sectionIndex; // Province RadComboBox ddlprovince = ((RadComboBox)edititem.FindControl("ddlprovince")); ddlprovince.DataSource = (from p in db.Provinces where p.SectionId == int.Parse(ddlSection.SelectedValue) select p); ddlprovince.DataTextField = "ProvinceName"; ddlprovince.DataValueField = "Id"; ddlprovince.DataBind(); ddlprovince.SelectedValue = provinceIndex; //District RadComboBox ddlDistricts = ((RadComboBox)edititem.FindControl("ddlDistricts")); ddlDistricts.DataSource = (from d in db.Districts where d.ProvinceId == int.Parse(ddlprovince.SelectedValue) select d); ddlDistricts.DataTextField = "DistrictName"; ddlDistricts.DataValueField = "Id"; ddlDistricts.DataBind(); ddlDistricts.SelectedValue = districtIndex; string groupIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfGroup")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfGroup")).Value; string regionIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfRegion")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfRegion")).Value; string areaIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfArea")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfArea")).Value; string localIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfLocal")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfLocal")).Value; //Group RadComboBox ddlGroup = ((RadComboBox)edititem.FindControl("ddlGroup")); ddlGroup.DataSource = db.Groups; ddlGroup.DataTextField = "GroupName"; ddlGroup.DataValueField = "Id"; ddlGroup.DataBind(); ddlGroup.SelectedValue = groupIndex; //Region RadComboBox ddlRegion = ((RadComboBox)edititem.FindControl("ddlRegion")); ddlRegion.DataSource = (from r in db.Regions where r.GroupId == Convert.ToInt32(ddlGroup.SelectedValue) select r); ddlRegion.DataTextField = "RegionName"; ddlRegion.DataValueField = "Id"; ddlRegion.DataBind(); ddlRegion.SelectedValue = regionIndex; //Area RadComboBox ddlArea = ((RadComboBox)edititem.FindControl("ddlArea")); ddlArea.DataSource = (from a in db.Areas where a.RegionId == Convert.ToInt32(ddlRegion.SelectedValue) select a); ddlArea.DataTextField = "AreaName"; ddlArea.DataValueField = "Id"; ddlArea.DataBind(); ddlArea.SelectedValue = areaIndex; //Location RadComboBox ddlLocation = ((RadComboBox)edititem.FindControl("ddlLocation")); ddlLocation.DataSource = (from l in db.Locals where l.AreaId == Convert.ToInt32(ddlArea.SelectedValue) select l); ddlLocation.DataTextField = "LocalName"; ddlLocation.DataValueField = "Id"; ddlLocation.DataBind(); ddlLocation.SelectedValue = localIndex; // Note of Salesmen vwCustomer vCustomer = e.Item.DataItem as vwCustomer; if(vCustomer != null) { string noteOfSalesmen = vCustomer.NoteOfSalesmen; var txtNoteOfSalesmen = ((TextBox)edititem.FindControl("txtNoteOfSalesmen")); if (txtNoteOfSalesmen != null) txtNoteOfSalesmen.Text = noteOfSalesmen; } } } }
public CustomerSuperviorRepository() { db = new UPIDataContext(); }
protected void ddlprovince_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) { using (UPIDataContext db = new UPIDataContext()) { GridEditableItem editedItem = (o as RadComboBox).NamingContainer as GridEditableItem; RadComboBox ddlDistricts = editedItem["DistrictColumn"].FindControl("ddlDistricts") as RadComboBox; ddlDistricts.DataSource = (from d in db.Districts where d.ProvinceId == (Convert.ToInt32(e.Value)) select d); ddlDistricts.DataTextField = "DistrictName"; ddlDistricts.DataValueField = "Id"; ddlDistricts.DataBind(); } }
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) { GridEditableItem edititem = (GridEditableItem)e.Item; Hashtable values = new Hashtable(); edititem.ExtractValues(values); using (UPIDataContext db = new UPIDataContext()) { string supervisorIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfSupervisor")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfSupervisor")).Value; //Supervisor RadComboBox ddlSupervisor = ((RadComboBox)edititem.FindControl("ddlSupervisor")); ddlSupervisor.DataSource = db.CustomerSupervisors; ddlSupervisor.DataTextField = "FullName"; ddlSupervisor.DataValueField = "Id"; ddlSupervisor.DataBind(); ddlSupervisor.SelectedValue = supervisorIndex; string custTypeIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfCustomerType")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfCustomerType")).Value; string custIndex = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfCustomer")).Value) ? "0" : ((HiddenField)edititem.FindControl("hdfCustomer")).Value; //CustomerType RadComboBox ddlCustomerType = ((RadComboBox)edititem.FindControl("ddlCustomerType")); ddlCustomerType.DataSource = db.CustomerTypes; ddlCustomerType.DataTextField = "TypeName"; ddlCustomerType.DataValueField = "Id"; ddlCustomerType.DataBind(); ddlCustomerType.SelectedValue = custTypeIndex; //Customer RadComboBox ddlCustomers = ((RadComboBox)edititem.FindControl("ddlCustomer")); ddlCustomers.DataSource = (from c in db.Customers where c.CustomerTypeId == (Convert.ToInt32(ddlCustomerType.SelectedValue)) select c); ddlCustomers.DataTextField = "FullName"; ddlCustomers.DataValueField = "Id"; ddlCustomers.DataBind(); ddlCustomers.SelectedValue = custIndex; } } }
public SalesmanRepository() { db = new UPIDataContext(); }
public CustomersLogRepository() { db = new UPIDataContext(); }
public SmsTypeRepository() { db = new UPIDataContext(); }
public RolesRepository() { db = new UPIDataContext(); }
public CustomerTypeRepository() { db = new UPIDataContext(); }
public SectionRepository() { db = new UPIDataContext(); }
protected void gridSchedulePromotion_ItemDataBound(object sender, GridItemEventArgs e) { if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) { GridEditableItem edititem = (GridEditableItem)e.Item; string promoId = "-1"; if (e.Item.OwnerTableView.IsItemInserted) { // remove session var session = HttpContext.Current.Session; bool? updateStatus = session[Constant.UpdateStatusSessionName] as bool?; if(updateStatus == null || (updateStatus.HasValue && updateStatus.Value)) { session.Remove(Constant.PromotionHistorySessionName); } } else { promoId = edititem.GetDataKeyValue("Id").ToString(); } Hashtable values = new Hashtable(); edititem.ExtractValues(values); using (UPIDataContext db = new UPIDataContext()) { RadDatePicker txtStartDate = ((RadDatePicker)edititem.FindControl("txtStartDate")); string StartDate = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfStartDate")).Value) ? string.Empty : ((HiddenField)edititem.FindControl("hdfStartDate")).Value; txtStartDate.DbSelectedDate = StartDate; string EndDate = String.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfEndDate")).Value) ? string.Empty : ((HiddenField)edititem.FindControl("hdfEndDate")).Value; RadDatePicker txtEndDate = ((RadDatePicker)edititem.FindControl("txtEndDate")); txtEndDate.DbSelectedDate = EndDate; string webcontent = String.IsNullOrEmpty(((Literal)edititem.FindControl("hdfWebContent")).Text) ? string.Empty : ((Literal)edititem.FindControl("hdfWebContent")).Text; RadEditor RadEditor1 = (RadEditor)edititem.FindControl("RadEditor1"); RadEditor1.Content = webcontent; string smscontent = String.IsNullOrEmpty(((Literal)edititem.FindControl("hdfSMSContent")).Text) ? string.Empty : ((Literal)edititem.FindControl("hdfSMSContent")).Text; TextBox txtSMSContent = ((TextBox)edititem.FindControl("txtSMSContent")); txtSMSContent.Text = smscontent; var PhoneNumber = string.IsNullOrEmpty(((HiddenField)edititem.FindControl("hdfPhoneList")).Value) ? string.Empty : ((HiddenField)edititem.FindControl("hdfPhoneList")).Value; var txtPhoneNumber = edititem.FindControl("txtPhoneNumber") as TextBox; if (txtPhoneNumber != null) { txtPhoneNumber.Text = PhoneNumber; } string clientScriptString = string.Format("BindPromotionHistory({0});", promoId); Page.ClientScript.RegisterStartupScript(GetType(), "gridSchedulePromotion", clientScriptString, true); } } }
public LocalsRepository() { db = new UPIDataContext(); }
public SchedulePromotionRepository() { db = new UPIDataContext(); }
public AreasRepository() { db = new UPIDataContext(); }
public ChannelRepository() { db = new UPIDataContext(); }
public SMSObjRepository() { db = new UPIDataContext(); lstVwSms = GetAllView(); }