void GetInfo() { if (!string.IsNullOrEmpty(ContactId)) { _rpoObj = new ContactRepository(); Contact ContactEnt = _rpoObj.LoadById(ContactId); if (ContactEnt != null) { txtTitle.Text = ContactEnt.Title; txtAddress.Text = ContactEnt.Address; txtPhone.Text = ContactEnt.Phone; txtMobile.Text = ContactEnt.Mobile; txtFax.Text = ContactEnt.Fax; txtEmail.Text = ContactEnt.Email; txtWorkHours.Text = ContactEnt.WorkHours; try { ddlLanguage.SelectedValue = ContactEnt.LanguageId.ToString(); } catch { ddlLanguage.SelectedIndex = -1; } } } }
private void LoadContactMEnu() { ContactRepository _conatcRepo = new ContactRepository(); Contact _Contact = _conatcRepo.LoadById("1AD20BF6-FB40-4661-B3D3-F9FB2BB22077"); lblemailmenu .Text = _Contact.Email; lblPhoneMenue.Text = _Contact.Phone; }
protected void grdData_RowCommand(object sender, GridViewCommandEventArgs e) { _rpoObj = new ContactRepository(); switch (e.CommandName) { case "restoreitem": if (_rpoObj.Restore(e.CommandArgument.ToString(), Request.Cookies["CooLoginUserId"].Value)) { grdData.DataBind(); } break; case "deleteitem": if (_rpoObj.Delete(e.CommandArgument.ToString(), Request.Cookies["CooLoginUserId"].Value)) { grdData.DataBind(); } break; } }
private void LoadByLanguageID() { _rpoObj = new ContactRepository(); grdData.DataSource = _rpoObj.LoadByLanguageId(ddlLanguage.SelectedValue.ToString()); grdData.DataBind(); }
private void LoadContact() { ContactRepository _conatcRepo = new ContactRepository(); Contact _Contact = _conatcRepo.LoadById("1AD20BF6-FB40-4661-B3D3-F9FB2BB22077"); lblContactPhone.Text = _Contact.Phone; lblContactFax.Text = _Contact.Fax; lblContactEmail.Text = _Contact.Email; lblContactAddress.Text = _Contact.Address; lblcontactWorkHours.Text = _Contact.WorkHours; lblemailmenu.Text = _Contact.Email; lblPhoneMenue.Text = _Contact.Phone; }
void Save() { string ImageFile = string.Empty; _rpoObj = new ContactRepository(); #region Manage Item //string FileName = string.Empty; _rpoObj._Obj.LanguageId = new Guid(ddlLanguage.SelectedValue.ToString()); _rpoObj._Obj.Title = txtTitle.Text; _rpoObj._Obj.Address = txtAddress.Text; _rpoObj._Obj.Phone = txtPhone.Text; _rpoObj._Obj.Mobile = txtMobile.Text; _rpoObj._Obj.Fax = txtFax.Text; _rpoObj._Obj.Email = txtEmail.Text; _rpoObj._Obj.WorkHours = txtWorkHours.Text; //isdefault here if (string.IsNullOrEmpty(ContactId)) { _rpoObj._Obj.CreatedBy = new Guid(Request.Cookies["CooLoginUserId"].Value); //if (fpld.PostedFile.FileName != "") //{ // FileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(fpld.PostedFile.FileName); // string PathUrl = Server.MapPath(ConfigurationManager.AppSettings["Pages"].ToString()) + FileName; // fpld.SaveAs(PathUrl); // // DAL.ImagesFact.ResizeWithCropResizeImage("", FileName, "Section"); // _PageSectionManagement._pageSection.ImageFile = FileName; //} ContactId = _rpoObj.Add().ToString(); //if (!string.IsNullOrEmpty(PageSectionId)) //{ // BackendMessages(101); //} //else //{ // BackendMessages(201); //} } else { _rpoObj._Obj = _rpoObj.LoadById(ContactId); _rpoObj._Obj.LanguageId = new Guid(ddlLanguage.SelectedValue.ToString()); _rpoObj._Obj.Title = txtTitle.Text; _rpoObj._Obj.Address = txtAddress.Text; _rpoObj._Obj.Phone = txtPhone.Text; _rpoObj._Obj.Mobile = txtMobile.Text; _rpoObj._Obj.Fax = txtFax.Text; _rpoObj._Obj.Email = txtEmail.Text; _rpoObj._Obj.WorkHours = txtWorkHours.Text; //if (fpld.PostedFile.FileName != "") //{ // if (_PageSectionManagement._pageSection.ImageFile != null) // { // DirectoryInfo di = new DirectoryInfo(Server.MapPath(ConfigurationManager.AppSettings["Pages"])); // foreach (FileInfo fi in di.GetFiles()) // { // if (_PageSectionManagement._pageSection.ImageFile == fi.Name) // { // File.Delete(fi.Name); // } // } // } // FileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(fpld.PostedFile.FileName); // string PathUrl = Server.MapPath(ConfigurationManager.AppSettings["Pages"].ToString()) + FileName; // fpld.SaveAs(PathUrl); // // DAL.ImagesFact.ResizeWithCropResizeImage("", FileName, "Section"); // _PageSectionManagement._pageSection.ImageFile = FileName; //} _rpoObj._Obj.ModifiedBy = new Guid(Request.Cookies["CooLoginUserId"].Value); if (_rpoObj.Edit()) { //lblMessge.Text = "Done, changes has been saved successfully!"; //msg.Attributes["class"] = "msg-success"; } else { //lblMessge.Text = "Error, Please try again later!"; //msg.Attributes["class"] = "msg-error"; } } #endregion }