private void GetGRNServices(Guid GRNId) { GRNServiceBLL objServices = new GRNServiceBLL(); List <GRNServiceBLL> list = objServices.GetByGRNId(GRNId); ViewState["grnServiceList"] = list; this.gvGRNService.DataSource = list; this.gvGRNService.DataBind(); }
public static bool Insert(GRNServiceBLL obj, SqlTransaction tran) { bool IsSaved = false;; string strSql = "spInsertGRNService"; SqlParameter[] arPar = new SqlParameter[6]; arPar[0] = new SqlParameter("@id", SqlDbType.UniqueIdentifier); arPar[0].Value = obj.Id; arPar[1] = new SqlParameter("@GRNId", SqlDbType.UniqueIdentifier); arPar[1].Value = obj.GRNId; arPar[2] = new SqlParameter("@ServiceId", SqlDbType.UniqueIdentifier); arPar[2].Value = obj.ServiceId; arPar[3] = new SqlParameter("@Quantity", SqlDbType.Float); arPar[3].Value = obj.Quantity; arPar[4] = new SqlParameter("@Status", SqlDbType.Int); arPar[4].Value = (int)obj.Status; arPar[5] = new SqlParameter("@CreatedBy", SqlDbType.UniqueIdentifier); arPar[5].Value = UserBLL.GetCurrentUser(); int Affectedrow = 0; try { Affectedrow = SqlHelper.ExecuteNonQuery(tran, strSql, arPar); if (Affectedrow == 1) { IsSaved = true;; } else { IsSaved = false; return(IsSaved); } } catch (Exception ex) { throw new Exception("Unable to add GRN Service.", ex); } return(IsSaved); }
protected void gvGRNService_RowDeleting(object sender, GridViewDeleteEventArgs e) { int row = -1; row = e.RowIndex; if (row != -1) { Label lblId = (Label)this.gvGRNService.Rows[row].FindControl("lblId"); if (lblId == null) { this.lblmsg.Text = "unable to get GRN service Id"; return; } if (lblId.Text == "") { this.lblmsg.Text = "unable to get GRN service Id"; return; } Guid GSId = new Guid(lblId.Text); List <GRNServiceBLL> list = new List <GRNServiceBLL>(); list = (List <GRNServiceBLL>)ViewState["grnServiceList"]; try { GRNServiceBLL objGS = new GRNServiceBLL(); if (objGS.Cancel(GSId) == true) { GetGRNServices(new Guid(this.hfGRNId.Value.ToString())); this.lblmsg.Text = "Data updated Successfully"; } else { this.lblmsg.Text = "Unable to update data"; } } catch { this.lblmsg.Text = "Unable to remove item!"; } } }
protected void btnGRNService_Click(object sender, EventArgs e) { Guid Id = Guid.NewGuid(); if (this.cboGRNService.SelectedValue == "") { this.lblmsg.Text = "Please Select GRN Service"; return; } Guid SeviceId = new Guid(this.cboGRNService.SelectedValue); int index = int.Parse(this.cboGRNService.SelectedIndex.ToString()); int TotNumberPerunit = int.Parse(txtTotalNumberPerUnit.Text); GRNServiceBLL obj = new GRNServiceBLL(); obj.Id = Id; obj.ServiceId = SeviceId; obj.Quantity = TotNumberPerunit; obj.Status = GRNServiceStatus.Active; obj.ServiceName = this.cboGRNService.SelectedItem.ToString(); List <GRNServiceBLL> list = new List <GRNServiceBLL>(); list = (List <GRNServiceBLL>)ViewState["listGRNService"]; if (list != null) { list.Add(obj); ViewState["listGRNService"] = list; } else { list = new List <GRNServiceBLL>(); list.Add(obj); ViewState["listGRNService"] = list; } this.gvGRNService.DataSource = list; this.gvGRNService.DataBind(); this.cboGRNService.SelectedIndex = -1; this.txtTotalNumberPerUnit.Text = ""; }
protected void btnGRNService_Click(object sender, EventArgs e) { GRNServiceBLL objGS = new GRNServiceBLL(); objGS.Id = Guid.NewGuid(); objGS.GRNId = new Guid(this.hfGRNId.Value.ToString()); objGS.ServiceId = new Guid(this.cboGRNService.SelectedValue.ToString()); objGS.ServiceName = this.cboGRNService.SelectedItem.ToString(); objGS.CreatedBy = UserBLL.GetCurrentUser(); objGS.Status = GRNServiceStatus.Active; if (objGS.Save() == true) { this.lblmsg.Text = "Data Updated Successfully"; List <GRNServiceBLL> list = new List <GRNServiceBLL>(); list = (List <GRNServiceBLL>)ViewState["grnServiceList"]; list.Add(objGS); this.gvGRNService.DataSource = list; this.gvGRNService.DataBind(); } else { this.lblmsg.Text = "Unable to Update data."; } }
public static List <GRNServiceBLL> GetByGRNId(Guid GRNId) { string strSql = "spGetGRNServicesByGRNId"; List <GRNServiceBLL> list = null; SqlConnection conn = null; try { conn = Connection.getConnection(); SqlParameter[] arPar = new SqlParameter[1]; arPar[0] = new SqlParameter("@GRNId", SqlDbType.UniqueIdentifier); arPar[0].Value = GRNId; SqlDataReader reader; reader = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, strSql, arPar); if (reader != null) { list = new List <GRNServiceBLL>(); while (reader.Read()) { GRNServiceBLL obj = new GRNServiceBLL(); if (reader["Id"] != DBNull.Value) { obj.Id = new Guid(reader["Id"].ToString()); } if (reader["GRNId"] != DBNull.Value) { obj.GRNId = new Guid(reader["GRNId"].ToString()); } if (reader["ServiceId"] != DBNull.Value) { obj.ServiceId = new Guid(reader["ServiceId"].ToString()); } if (reader["Quantity"] != DBNull.Value) { obj.Quantity = int.Parse(reader["Quantity"].ToString()); } if (reader["Status"] != DBNull.Value) { obj.Status = (GRNServiceStatus)int.Parse(reader["Status"].ToString()); } if (reader["CreatedBy"] != DBNull.Value) { obj.CreatedBy = new Guid(reader["CreatedBy"].ToString()); } if (reader["CreatedTimestamp"] != DBNull.Value) { obj.CreatedTimestamp = DateTime.Parse(reader["CreatedTimestamp"].ToString()); } if (reader["LastModifiedBy"] != DBNull.Value) { obj.LastModifiedBy = new Guid(reader["LastModifiedBy"].ToString()); } if (reader["LastModifiedTimestamp"] != DBNull.Value) { obj.LastModifiedTimestamp = DateTime.Parse(reader["LastModifiedTimestamp"].ToString()); } list.Add(obj); } } } catch (Exception ex) { throw ex; } finally { if (conn.State == ConnectionState.Open) { conn.Close(); } } return(list); }
private void rptGRNService_ReportStart(object sender, EventArgs e) { GRNServiceBLL objGS = new GRNServiceBLL(); this.reader = objGS.GetActiveByGRNId(this.GradingIdSubReport); }