protected void GrdReport_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { int DeleteId = 0; int CurRow = Convert.ToInt32(e.RowIndex); DeleteId = Convert.ToInt32(GrdReport.Rows[CurRow].Cells[7].Text); //ViewState["EditID"] = IssueRegisterID; if (DeleteId != 0) { Entity_IssueRegister.IssueRegisterId = DeleteId; Entity_IssueRegister.UserId = Convert.ToInt32(Session["UserID"]); Entity_IssueRegister.LoginDate = DateTime.Now; Entity_IssueRegister.IsDeleted = true; int iDelete = Obj_IssueRegister.DeleteIssueRegister(ref Entity_IssueRegister, out StrError); if (iDelete != 0) { Obj_Comm.ShowPopUpMsg("Record Succesfully Deleted", this.Page); MakeEmptyForm(); } } Entity_IssueRegister = null; Obj_IssueRegister = null; } catch (Exception ex) { throw new Exception(ex.Message); } }
public void IssueRegister_CanBeCreated() { //Given IssueRegister issueRegister; //When issueRegister = new IssueRegister(); //Then Assert.NotNull(issueRegister); }
public int InsertIssueRegister(ref IssueRegister Entity_Call, out string StrError) { int iInsert = 0; StrError = string.Empty; try { SqlParameter pAction = new SqlParameter(IssueRegister._Action, SqlDbType.BigInt); SqlParameter pIssueNo = new SqlParameter(IssueRegister._IssueNo, SqlDbType.NVarChar); SqlParameter pIssueDate = new SqlParameter(IssueRegister._IssueDate, SqlDbType.DateTime); SqlParameter pEmployeeId = new SqlParameter(IssueRegister._EmployeeId, SqlDbType.BigInt); SqlParameter pRequisitionCafeId = new SqlParameter(IssueRegister._RequisitionCafeId, SqlDbType.BigInt); SqlParameter pLoginDate = new SqlParameter(IssueRegister._LoginDate, SqlDbType.DateTime); SqlParameter pUserId = new SqlParameter(IssueRegister._UserId, SqlDbType.BigInt); SqlParameter pIsDeleted = new SqlParameter(IssueRegister._IsDeleted, SqlDbType.Bit); pAction.Value = 1; pIssueNo.Value = Entity_Call.IssueNo; pIssueDate.Value = Entity_Call.IssueDate; pEmployeeId.Value = Entity_Call.EmployeeId; pRequisitionCafeId.Value = Entity_Call.RequisitionCafeId; pUserId.Value = Entity_Call.UserId; pLoginDate.Value = Entity_Call.LoginDate; pIsDeleted.Value = Entity_Call.IsDeleted; SqlParameter[] param = new SqlParameter[] { pAction, pIssueNo, pIssueDate, pEmployeeId, pRequisitionCafeId, pLoginDate, pUserId, pIsDeleted }; Open(CONNECTION_STRING); BeginTransaction(); iInsert = SQLHelper.ExecuteScalar(_Connection, _Transaction, CommandType.StoredProcedure, IssueRegister.SP_IssueRegister, param); if (iInsert > 0) { CommitTransaction(); } else { RollBackTransaction(); } } catch (Exception ex) { throw new Exception(ex.Message); RollBackTransaction(); } finally { Close(); } return(iInsert); }
public int InsertIssueRegisterDetails(ref IssueRegister Entity_Call, out string StrError) { StrError = string.Empty; int iInsert = 0; try { SqlParameter pAction = new SqlParameter(IssueRegister._Action, SqlDbType.BigInt); SqlParameter pIssueRegisterId = new SqlParameter(IssueRegister._IssueRegisterId, SqlDbType.BigInt); SqlParameter pItemId = new SqlParameter(IssueRegister._ItemId, SqlDbType.BigInt); SqlParameter pIssueQty = new SqlParameter(IssueRegister._IssueQty, SqlDbType.Decimal); SqlParameter pPendingQty = new SqlParameter(IssueRegister._PendingQty, SqlDbType.Decimal); SqlParameter pQty = new SqlParameter(IssueRegister._Qty, SqlDbType.Decimal); SqlParameter pNotes = new SqlParameter(IssueRegister._Notes, SqlDbType.NVarChar); pAction.Value = 8; pIssueRegisterId.Value = Entity_Call.IssueRegisterId; pItemId.Value = Entity_Call.ItemId; pIssueQty.Value = Entity_Call.IssueQty; pPendingQty.Value = Entity_Call.PendingQty; pQty.Value = Entity_Call.Qty; pNotes.Value = Entity_Call.Notes; SqlParameter[] param = new SqlParameter[] { pAction, pIssueRegisterId, pItemId, pPendingQty, pIssueQty, pQty, pNotes }; Open(CONNECTION_STRING); BeginTransaction(); iInsert = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, IssueRegister.SP_IssueRegister, param); if (iInsert > 0) { CommitTransaction(); } else { RollBackTransaction(); } } catch (Exception ex) { RollBackTransaction(); throw new Exception(ex.Message); } finally { Close(); } return(iInsert); }
public int DeleteIssueRegister(ref IssueRegister Entity_Call, out string StrError) { StrError = string.Empty; int iDelete = 0; try { SqlParameter pAction = new SqlParameter(IssueRegister._Action, SqlDbType.BigInt); SqlParameter pIssueRegisterId = new SqlParameter(IssueRegister._IssueRegisterId, SqlDbType.BigInt); SqlParameter pIsDeleted = new SqlParameter(IssueRegister._IsDeleted, SqlDbType.Bit); SqlParameter pDeletedBy = new SqlParameter(IssueRegister._UserId, SqlDbType.BigInt); SqlParameter pDeletedDate = new SqlParameter(IssueRegister._LoginDate, SqlDbType.DateTime); pAction.Value = 3; pIssueRegisterId.Value = Entity_Call.IssueRegisterId; pIsDeleted.Value = Entity_Call.IsDeleted; pDeletedBy.Value = Entity_Call.UserId; pDeletedDate.Value = Entity_Call.LoginDate; SqlParameter[] param = new SqlParameter[] { pAction, pIssueRegisterId, pIsDeleted, pDeletedBy, pDeletedDate }; Open(CONNECTION_STRING); BeginTransaction(); iDelete = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, IssueRegister.SP_IssueRegister, param); if (iDelete > 0) { CommitTransaction(); } else { RollBackTransaction(); } } catch (Exception ex) { RollBackTransaction(); throw new Exception(ex.Message); } finally { Close(); } return(iDelete); }
protected void BtnSave_Click(object sender, EventArgs e) { int InsertRow = 0, InsertRowDetails = 0; try { if (ChkDetails() == true) { Entity_IssueRegister.IssueNo = TxtMIssueNo.Text; Entity_IssueRegister.IssueDate = !string.IsNullOrEmpty(TxtReqstnDate.Text)?Convert.ToDateTime(TxtReqstnDate.Text.Trim()):DateTime.Now; Entity_IssueRegister.EmployeeId = Convert.ToString(Session["UserId"]);//Convert.ToString(ddlIssueTo.SelectedValue); Entity_IssueRegister.RequisitionCafeId = Convert.ToInt32(ddlRequisitionNo.SelectedValue); Entity_IssueRegister.UserId = Convert.ToInt32(Session["UserId"]); Entity_IssueRegister.LoginDate = DateTime.Now; Entity_IssueRegister.IsDeleted = false; InsertRow = Obj_IssueRegister.InsertIssueRegister(ref Entity_IssueRegister, out StrError); if (InsertRow > 0) { if (ViewState["CurrentTable"] != null) { for (int i = 0; i < GridDetails.Rows.Count; i++) { if (Convert.ToInt32(((TextBox)GridDetails.Rows[i].FindControl("TxtIssueQty")).Text) > 0) { Entity_IssueRegister.IssueRegisterId = InsertRow; Entity_IssueRegister.ItemId = Convert.ToInt32(GridDetails.Rows[i].Cells[0].Text); Entity_IssueRegister.IssueQty = Convert.ToDecimal(((TextBox)GridDetails.Rows[i].FindControl("TxtIssueQty")).Text); // Entity_IssueRegister.StockLocationID = Convert.ToInt32(((DropDownList)GridDetails.Rows[i].FindControl("ddlIssueLocation")).SelectedValue); Entity_IssueRegister.Notes = Convert.ToString(((TextBox)GridDetails.Rows[i].FindControl("TxtNotes")).Text); string[] OrderQty1 = (GridDetails.Rows[i].Cells[6].Text).Split(' '); decimal OrderQty = Convert.ToDecimal(OrderQty1[0]); Entity_IssueRegister.PendingQty = (Convert.ToDecimal(OrderQty) - Convert.ToDecimal(((TextBox)GridDetails.Rows[i].FindControl("TxtIssueQty")).Text));//Convert.ToDecimal(OrderQty); string[] OrderQty2 = (GridDetails.Rows[i].Cells[4].Text).Split(' '); decimal OrderQty3 = Convert.ToDecimal(OrderQty2[0]); Entity_IssueRegister.Qty = Convert.ToDecimal(OrderQty3); InsertRowDetails = Obj_IssueRegister.InsertIssueRegisterDetails(ref Entity_IssueRegister, out StrError); } } } if (InsertRow > 0) { Obj_Comm.ShowPopUpMsg("Record Saved Successfully...!", this.Page); MakeEmptyForm(); ddlRequisitionNo.SelectedValue = "0"; Entity_IssueRegister = null; Obj_IssueRegister = null; } } } else { Obj_Comm.ShowPopUpMsg("Please Enter Details...!", this.Page); } } catch (Exception ex) { throw new Exception(ex.Message); } }