public string GetColorId(string strColorName) { string StrColor = ""; tblColor objColor = new tblColor(); objColor.Where.AppColorName.Value = strColorName; objColor.Query.Load(); if (objColor.RowCount <= 0) { objColor.AddNew(); objColor.s_AppColorName = strColorName; objColor.AppColorCode = "#FFF"; objColor.AppIsActive = true; objColor.AppIsDefault = false; objCommon = new clsCommon(); objColor.AppDisplayOrder = objCommon.GetNextDisplayOrder("tblColor", tblColor.ColumnNames.AppDisplayOrder); objCommon = null; objColor.Save(); } StrColor = objColor.s_AppColorID; objColor = null; return(StrColor); }
public ActionResult DeleteConfirmed(int id) { tblColor tblColor = db.tblColors.Find(id); db.tblColors.Remove(tblColor); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ColorId,Color")] tblColor tblColor) { if (ModelState.IsValid) { db.Entry(tblColor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tblColor)); }
public ActionResult Create([Bind(Include = "ColorId,Color")] tblColor tblColor) { if (ModelState.IsValid) { db.tblColors.Add(tblColor); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tblColor)); }
// GET: Colors/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tblColor tblColor = db.tblColors.Find(id); if (tblColor == null) { return(HttpNotFound()); } return(View(tblColor)); }
private bool SaveData() { objCommon = new clsCommon(); if (objCommon.IsRecordExists("tblCurrency", tblCurrency.ColumnNames.AppCurrency, tblCurrency.ColumnNames.AppCurrencyID, txtCurrencyName.Text, hdnPKID.Value)) { DInfo.ShowMessage("Currency Name alredy exits.", Enums.MessageType.Error); return(false); } objCurrency = new tblCurrency(); if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "") { objCurrency.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)); } else { objCurrency.AddNew(); objCurrency.AppDisplayOrder = objCommon.GetNextDisplayOrder("tblCurrency", tblCurrency.ColumnNames.AppDisplayOrder); } objCurrency.AppCurrency = txtCurrencyName.Text; objCurrency.AppCurrencyCode = txtCurrencyCode.Text; objCurrency.s_AppRate = txtRate.Text; objCurrency.s_AppSymbol = txtSymbol.Text; objCurrency.AppIsActive = chkIsActive.Checked; if (chkIsDefault.Checked) { tblColor ObjTempcolor = new tblColor(); ObjTempcolor.SetDefaultColor(); ObjTempcolor = null; objCurrency.AppIsActive = true; objCurrency.AppIsDefault = true; } else { if (objCurrency.AppDisplayOrder == 1) { objCurrency.AppIsActive = true; objCurrency.AppIsDefault = true; } else { objCurrency.AppIsDefault = false; } } objCurrency.Save(); intPkId = objCurrency.AppCurrencyID; objCurrency = null; objCommon = null; return(true); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { SetUpPageContent(ref metaDescription, ref metaKeywords); objCommon = new clsCommon(); hdnProduct.Value = objCommon.GetParameterFromUrl(Enums.Enums_URLParameterType.ByNumber, "1"); lblLiteral.Text = " / " + hdnProduct.Value; this.Page.Title = hdnCategory.Value; objCommon = null; tblProperty objProperty = new tblProperty(); RepProperty.DataSource = objProperty.LoadProductWiseProperty(hdnProduct.Value); RepProperty.DataBind(); objProperty = null; tblProduct objProduct = new tblProduct(); decimal iPrice = objProduct.GetProductNameWiseMaxPrice(hdnProduct.Value); objProduct = null; iPrice = Math.Round(Convert.ToDecimal(HttpContext.Current.Session[appFunctions.Session.CurrencyInRupee.ToString()].ToString()) * iPrice, 0) + 100; hdnMaxPrice.Value = iPrice.ToString(); dtColor.DataSource = null; dtColor.DataBind(); tblColor objColor = new tblColor(); objColor.Where.AppIsActive.Value = true; objColor.Query.AddOrderBy(tblColor.ColumnNames.AppDisplayOrder, MyGeneration.dOOdads.WhereParameter.Dir.ASC); objColor.Query.Load(); if (objColor.RowCount > 0) { if (objColor.RowCount == 1) { if (objColor.s_AppIsDefault != "") { if (objColor.AppIsDefault) { Seccolor.Style.Add("display", "none"); } } } dtColor.DataSource = objColor.DefaultView.Table;; dtColor.DataBind(); } objColor = null; hdnOrderBy.Value = " vw_SerachProduct.appProductId Desc"; } }
private void LoadDataGrid(bool IsResetPageIndex, bool IsSort, string strFieldName = "", string strFieldValue = "") { objColor = new tblColor(); objDataTable = objColor.LoadGridData(ddlFields.SelectedValue, txtSearch.Text.Trim()); //'Reset PageIndex of gridviews if (IsResetPageIndex) { if (dgvGridView.PageCount > 0) { dgvGridView.PageIndex = 0; } } dgvGridView.DataSource = null; dgvGridView.DataBind(); lblCount.Text = 0.ToString(); hdnSelectedIDs.Value = ""; //'Check for data into datatable if (objDataTable.Rows.Count <= 0) { DInfo.ShowMessage("No data found", Enums.MessageType.Information); return; } else { if (ddlPerPage.SelectedItem.Text.ToLower() == "all") { dgvGridView.AllowPaging = false; } else { dgvGridView.AllowPaging = true; dgvGridView.PageSize = Convert.ToInt32(ddlPerPage.SelectedItem.Text); } lblCount.Text = objDataTable.Rows.Count.ToString(); objDataTable = SortDatatable(objDataTable, ViewState["SortColumn"].ToString(), (appFunctions.Enum_SortOrderBy)ViewState["SortOrder"], IsSort); dgvGridView.DataSource = objDataTable; dgvGridView.DataBind(); } objColor = null; }
private bool Delete(int intPKID) { bool retval = false; objColor = new tblColor(); var _with1 = objColor; if (_with1.LoadByPrimaryKey(intPKID)) { if (!_with1.AppIsDefault) { _with1.MarkAsDeleted(); _with1.Save(); retval = true; } } objColor = null; return(retval); }
private void SetValuesToControls() { if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "") { objColor = new tblColor(); if (objColor.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value))) { // txtColor.Text = objColor.AppColorCode; // txtColor.Style.Add("background-Color", objColor.s_AppColorCode); txtColorName.Text = objColor.AppColorName; chkIsActive.Checked = objColor.AppIsActive; chkIsDefault.Checked = objColor.AppIsDefault; if (chkIsDefault.Checked) { chkIsDefault.Enabled = false; } if (objColor.AppColorImage != "") { img.ImageUrl = objColor.AppColorImage; } } objColor = null; } }
protected void dgvGridView_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { if (!string.IsNullOrEmpty(e.CommandArgument.ToString())) { objCommon = new clsCommon(); if (e.CommandName == "Up") { LinkButton inkButton = (LinkButton)e.CommandSource; GridViewRow drCurrent = (GridViewRow)inkButton.Parent.Parent; if (drCurrent.RowIndex > 0) { GridViewRow drUp = dgvGridView.Rows[drCurrent.RowIndex - 1]; objCommon.SetDisplayOrder("tblColor", tblColor.ColumnNames.AppColorID, tblColor.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[1], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[1]); LoadDataGrid(false, false); objCommon = null; } } else if (e.CommandName == "Down") { LinkButton lnkButton = (LinkButton)e.CommandSource; GridViewRow drCurrent = (GridViewRow)lnkButton.Parent.Parent; if (drCurrent.RowIndex < dgvGridView.Rows.Count - 1) { GridViewRow drUp = dgvGridView.Rows[drCurrent.RowIndex + 1]; objCommon.SetDisplayOrder("tblColor", tblColor.ColumnNames.AppColorID, tblColor.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[1], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[1]); LoadDataGrid(false, false); objCommon = null; } } else if (e.CommandName == "IsActive") { objColor = new tblColor(); if (objColor.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()))) { if (!objColor.AppIsDefault) { if (objColor.AppIsActive == true) { objColor.AppIsActive = false; } else if (objColor.AppIsActive == false) { objColor.AppIsActive = true; } objColor.Save(); LoadDataGrid(false, false); } } objColor = null; } else if (e.CommandName == "IsDefault") { objColor = new tblColor(); objColor.SetDefaultColor(e.CommandArgument.ToString()); objColor = null; LoadDataGrid(false, false); } } }
private bool SaveData() { objCommon = new clsCommon(); if (objCommon.IsRecordExists("tblColor", tblColor.ColumnNames.AppColorName, tblColor.ColumnNames.AppColorID, txtColorName.Text, hdnPKID.Value)) { DInfo.ShowMessage("Color Name alredy exits.", Enums.MessageType.Error); return(false); } objColor = new tblColor(); if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "") { objColor.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)); } else { objColor.AddNew(); objColor.AppDisplayOrder = objCommon.GetNextDisplayOrder("tblColor", tblColor.ColumnNames.AppDisplayOrder); } // objColor.AppColorCode = txtColor.Text; string Time = Convert.ToString(DateTime.Now.Month) + Convert.ToString(DateTime.Now.Day) + Convert.ToString(DateTime.Now.Year) + Convert.ToString(DateTime.Now.Hour) + Convert.ToString(DateTime.Now.Minute) + Convert.ToString(DateTime.Now.Second); if (fileUploadColorImg.HasFile) { string strError = ""; string strPath = objCommon.FileUpload_Images(fileUploadColorImg.PostedFile, txtColorName.Text.Trim().Replace(" ", "_") + "_" + Time, "Uploads/ColorCode/", ref strError, 0, objColor.s_AppColorImage, false, 20, 20); if (strError == "") { objColor.s_AppColorImage = strPath; } else { DInfo.ShowMessage(strError, Enums.MessageType.Error); return(false); } } objColor.AppColorName = txtColorName.Text; objColor.AppIsActive = chkIsActive.Checked; if (chkIsDefault.Checked) { tblColor ObjTempcolor = new tblColor(); ObjTempcolor.SetDefaultColor(); ObjTempcolor = null; objColor.AppIsActive = true; objColor.AppIsDefault = true; } else { tblColor ObjTempcolor = new tblColor(); ObjTempcolor.LoadAll(); if (ObjTempcolor.RowCount <= 0) { objColor.AppIsActive = true; objColor.AppIsDefault = true; } else { objColor.AppIsDefault = false; } ObjTempcolor = null; } objColor.Save(); intPkId = objColor.AppColorID; objColor = null; objCommon = null; return(true); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { SetUpPageContent(ref metaDescription, ref metaKeywords); SetCartProductCount(); Setregularexpression(); objCommon = new clsCommon(); if (Session[appFunctions.Session.DInfoInquiry.ToString()] != null) { if (Session[appFunctions.Session.DInfoInquiry.ToString()] != "") { DInfo.ShowMessage(Session[appFunctions.Session.DInfoInquiry.ToString()].ToString(), Enums.MessageType.Successfull); Session[appFunctions.Session.DInfoInquiry.ToString()] = null; } } hdnProductName.Value = objCommon.GetParameterFromUrl(Enums.Enums_URLParameterType.ByNumber, "1"); string strColor = objCommon.GetParameterFromUrl(Enums.Enums_URLParameterType.ByNumber, "2"); if (hdnProductName.Value != "") { lblLiteral.Text = hdnProductName.Value; if (strColor != "") { tblColor objColor = new tblColor(); objColor.Where.AppColorName.Value = strColor; //objColor.Where.AppIsActive.Value = true; objColor.Query.Load(); if (objColor.RowCount > 0) { hdnColorId.Value = objColor.s_AppColorID; } else { hdnColorId.Value = "0"; } objColor = null; } objProduct = new tblProduct(); objProduct.Where.AppProductName.Value = hdnProductName.Value; objProduct.Query.Load(); if (objProduct.RowCount > 0) { this.Page.Title = objProduct.AppProductName; lblProductName.Text = objProduct.AppProductName; if (objProduct.s_AppDescription != "") { divDescription.InnerHtml = objProduct.s_AppDescription; } else { DataDescription.Visible = false; } if (objProduct.s_AppMetaKeyWord != "") { metaKeywords = objProduct.s_AppMetaKeyWord; } if (objProduct.s_AppMetaDescription != "") { metaDescription = objProduct.s_AppMetaDescription; } DivWashCare.InnerHtml = objProduct.s_AppWashCare; hdnPKID.Value = objProduct.s_AppProductID; if (objProduct.s_AppEstimatedDeliveryDays != "") { lblDeliveryDays.Text = objProduct.s_AppEstimatedDeliveryDays; } if (objProduct.s_AppIsSize != "") { if (!objProduct.AppIsSize) { divProductSize.Style.Add("display", "none"); hdnIsSize.Value = "false"; } else { divProductSize.Style.Add("display", "block"); hdnIsSize.Value = "true"; } } if (objProduct.s_AppIsColor != "") { if (!objProduct.AppIsColor) { divProductColor.Style.Add("display", "none"); hdnIsColor.Value = "false"; } else { divProductColor.Style.Add("display", "block"); hdnIsColor.Value = "true"; } } LoadColor(); LoadColorWiseImages(); LoadReviewList(); LoadRelatedProduct(); LoadRecentProduct(); if ((Session[appFunctions.Session.ClientUserID.ToString()] != null)) { if ((Session[appFunctions.Session.ClientUserName.ToString()]) != "" || (Session[appFunctions.Session.ClientUserID.ToString()]) != "0") { divReviewForm.Visible = true; btnClickHere.Visible = false; } else { divReviewForm.Visible = false; btnClickHere.Visible = true; } } else { divReviewForm.Visible = false; btnClickHere.Visible = true; } } objProduct = null; } LoadPixcelCode(); this.Page.Title = hdnProductName.Value; } }