private void SaveInfo(string strLink = "") { try { string Name = txtName.Value; string Desc = txtDesc.Value; if (m_unit_id == 0) { //insert ESHOP_UNIT g_insert = new ESHOP_UNIT(); g_insert.UNIT_NAME = Name; g_insert.UNIT_DESC = Desc; DB.ESHOP_UNITs.InsertOnSubmit(g_insert); DB.SubmitChanges(); strLink = string.IsNullOrEmpty(strLink) ? "units_list.aspx" : strLink; } else { //update var g_update = DB.GetTable <ESHOP_UNIT>().Where(g => g.UNIT_ID == m_unit_id); if (g_update.ToList().Count > 0) { g_update.Single().UNIT_NAME = Name; g_update.Single().UNIT_DESC = Desc; DB.SubmitChanges(); strLink = string.IsNullOrEmpty(strLink) ? "units_list.aspx" : strLink; } } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { if (!string.IsNullOrEmpty(strLink)) { Response.Redirect(strLink); } } }
private void SaveInfo(string strLink = "") { try { string Name = txtName.Value; string Desc = txtDesc.Value; if (m_unit_id == 0) { //insert ESHOP_UNIT g_insert = new ESHOP_UNIT(); g_insert.UNIT_NAME= Name; g_insert.UNIT_DESC = Desc; DB.ESHOP_UNITs.InsertOnSubmit(g_insert); DB.SubmitChanges(); strLink = string.IsNullOrEmpty(strLink) ? "units_list.aspx" : strLink; } else { //update var g_update = DB.GetTable<ESHOP_UNIT>().Where(g => g.UNIT_ID == m_unit_id); if (g_update.ToList().Count > 0) { g_update.Single().UNIT_NAME = Name; g_update.Single().UNIT_DESC = Desc; DB.SubmitChanges(); strLink = string.IsNullOrEmpty(strLink) ? "units_list.aspx" : strLink; } } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { if (!string.IsNullOrEmpty(strLink)) { Response.Redirect(strLink); } } }