private bool StoreinDB(byte[] buffer, ManageUserSVC.ManageUserClient client, ManageUserSVC.ManageUserCoverageData Coverage)
        {
            bool Valid = true;
            List <usp_GetEvedenceResult> DsCus = new List <usp_GetEvedenceResult>();

            DsCus = client.GetEvedenceInfoByCusID(Guid.Parse(Session["CustomerIDForAdmin"].ToString()));

            if (DsCus != null && DsCus.Count > 0)
            {
                foreach (usp_GetEvedenceResult item in DsCus)
                {
                    if (item.IsActive.Value)
                    {
                        client.Update_Evidence(Guid.Parse(Session["CustomerIDForAdmin"].ToString()), DateTime.Now, false, item.EvidenceID, true);
                    }
                }
            }

            if (DsCus != null && DsCus.Count > 0)
            {
                //client.Delete_Evidence(Guid.Parse(Session["CustomerIDForAdmin"].ToString()));

                //Insert Newely generated Evedence after renew...
                client.InsertEvedence(Guid.NewGuid(), DateTime.Now,
                                      Guid.Parse(Session["CustomerIDForAdmin"].ToString()), DateTime.Now, true, true, buffer);
            }
            else
            {
                //Inserted New Evedence.
                client.InsertEvedence(Guid.NewGuid(), DateTime.Now,
                                      Guid.Parse(Session["CustomerIDForAdmin"].ToString()), DateTime.Now, true, true, buffer);
            }

            return(Valid);
        }
        private bool StoreinDB(byte[] buffer, ManageUserSVC.ManageUserClient client)
        {
            bool    Valid = true;
            DataSet DsCus = new DataSet();

            //DsCus = client.GetEvedenceInfoByCusID(Guid.Parse(ViewState["ID"].ToString()));
            if (DsCus != null && DsCus.Tables[0].Rows.Count > 0)
            {
                bool ActveEve = false;
                Guid EVEID    = new Guid();
                foreach (DataRow item in DsCus.Tables[0].Rows)
                {
                    if (item["IsActive"].ToString().Equals("True"))
                    {
                        EVEID    = Guid.Parse(item["EvedenceID"].ToString());
                        ActveEve = true;
                        break;
                    }
                }

                if (ActveEve)
                {
                    DateTime EvedenceDate = Convert.ToDateTime(DsCus.Tables[0].Rows[0]["EvideDate"].ToString());
                    if (EvedenceDate < DateTime.Now && DateTime.Now < EvedenceDate.AddMonths(12))
                    {
                        //Updated LastUpdated Date and IsActive only...
                        client.Update_Evidence(Guid.Parse(ViewState["CusID"].ToString()), DateTime.Now, true, EVEID, false);
                    }
                    else
                    {
                        //Updated IsActive field, Evedence is not valid now, need to renew account.
                        client.Update_Evidence(Guid.Parse(ViewState["CusID"].ToString()), DateTime.Now, false, EVEID, false);
                        Valid = false;
                    }
                }
                else
                {
                    // If Account get renewd, then again insert new evedence information without affecting older records.
                    client.InsertEvedence(Guid.Parse(ViewState["EvedenceID"].ToString()), Convert.ToDateTime(ViewState["CoverageDate"].ToString()),
                                          Guid.Parse(ViewState["CusID"].ToString()), DateTime.Now, true, true, buffer);
                }
            }
            else
            {
                //Inserted New Evedence.
                client.InsertEvedence(Guid.Parse(ViewState["EvedenceID"].ToString()), Convert.ToDateTime(ViewState["CoverageDate"].ToString()),
                                      Guid.Parse(ViewState["CusID"].ToString()), DateTime.Now, true, true, buffer);
            }

            return(Valid);
        }