protected void btnRejected_Click(object sender, EventArgs e) { string[] arIDs = hdnSelectedIDs.Value.ToString().TrimEnd(',').Split(','); bool IsReject = false; for (int i = 0; i <= arIDs.Length - 1; i++) { if (!string.IsNullOrEmpty(arIDs.GetValue(i).ToString())) { objReturnOrder = new tblReturnOrder(); if (objReturnOrder.LoadByPrimaryKey(Convert.ToInt32(arIDs.GetValue(i)))) { if (objReturnOrder.RowCount > 0) { tblSubOrder objSubOrder = new tblSubOrder(); objSubOrder.SetOrderstatusWhenReturnReject(Convert.ToInt32(Enums.Enums_OrderStatus.Returned), objReturnOrder.AppPreviousSubOrderStatus, objReturnOrder.s_AppReturnOrderID, GetCurrentDateTime().ToString()); objSubOrder = null; objReturnOrder.AppReturnStatus = Convert.ToInt32(Enums.Enum_ReturnStatus.Reject); objReturnOrder.Save(); //if (arIDs[i].ToString() != "") //{ // SendMail(Convert.ToInt32(Enums.Enum_ReturnStatus.Reject), arIDs[i].ToString()); //} IsReject = true; } } objReturnOrder = null; } } if (IsReject) { LoadDataGrid(false, false); DInfo.ShowMessage("Return Order has been Reject successfully", Enums.MessageType.Successfull); } hdnSelectedIDs.Value = ""; }