Exemple #1
0
        public ENT.DMT_Documents GetByUserId(Guid guid)
        {
            ENT.DMT_Documents Entity = new ENT.DMT_Documents();
            try
            {
                parFields.Clear();

                //Add Query in to string builder object
                QueryDisctionery.SelectPart = "select top 1 * ";
                QueryDisctionery.TablePart  = @"from DMT_Documents ";

                QueryDisctionery.ParameterPart = "Where dd_userid='" + guid + "'";

                QueryDisctionery.OrderPart = "order by CreatedDateTime desc";

                //Execute Query and get SQLDataReader
                using (SqlDataReader dr = objDBHelper.ExecuteReaderQuery(QueryDisctionery, parFields, objEntity))
                {
                    Entity = COM.DBHelper.CopyDataReaderToSingleEntity <ENT.DMT_Documents>(dr);
                    objDBHelper.Disposed();
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                parFields.Clear();
            }
            return(Entity);
        }
        public JsonResult GetStatus()
        {
            int status = 0;

            ENT.DMT_Documents dMT_Documents = null;
            using (BAL.DMT_Documents objBal = new BAL.DMT_Documents())
            {
                dMT_Documents = objBal.GetByUserId(_LoginUserId);
            }

            if (dMT_Documents == null)
            {
                status = 1;
            }
            else
            {
                if (dMT_Documents.dd_status == 1)
                {
                    status = 2;
                }
                else if (dMT_Documents.dd_status == 2)
                {
                    status = 3;
                }
                else
                {
                    status = 4;
                }
            }
            return(Json(status, JsonRequestBehavior.AllowGet));
        }
Exemple #3
0
        // this function for just referance for partial update field user have to create seperate function learn from this function.
        public bool UpdatePartial(ENT.DMT_Documents objEntity)
        {
            bool blnResult = false;

            try
            {
                //Create Fields List in dictionary
                Dictionary <string, bool> dctFields = new Dictionary <string, bool>();
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_Documents>(x => x.dd_id), true);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_Documents>(x => x.dd_userid), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_Documents>(x => x.dd_page1), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_Documents>(x => x.dd_page2), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_Documents>(x => x.dd_type), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_Documents>(x => x.dd_status), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_Documents>(x => x.dd_remarks), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_Documents>(x => x.SystemDateTime), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_Documents>(x => x.CreatedBy), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_Documents>(x => x.CreatedDateTime), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_Documents>(x => x.UpdatedBy), false);
                dctFields.Add(COM.HelperMethod.PropertyName <ENT.DMT_Documents>(x => x.UpdatedDateTime), false);
                objEntity.FieldCollection = dctFields;
                if (objDAL.SaveChanges(objEntity.FieldCollection, objEntity))
                {
                    blnResult = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(blnResult);
        }
        public JsonResult SaveEntry(string backimage, string frontimage, int dd_type)
        {
            ENT.DMT_Documents model = new ENT.DMT_Documents();

            try
            {
                if (String.IsNullOrEmpty(frontimage))
                {
                    GlobalVarible.AddError("Please select Front Image.");
                    return(Json(MySession.Current.MessageResult));
                }
                else
                {
                    model.dd_page1 = SaveDmtDocument(frontimage);
                }

                if (String.IsNullOrEmpty(backimage))
                {
                    model.dd_page2 = string.Empty;
                }
                else
                {
                    model.dd_page2 = SaveDmtDocument(backimage);
                }

                model.dd_status       = (int)COM.MyEnumration.DMTDOCUMENTSTATUS.PENDING;
                model.dd_remarks      = string.Empty;
                model.CreatedDateTime = DateTime.Now;
                model.CreatedBy       = _LoginUserId;
                model.dd_userid       = _LoginUserId;
                model.dd_type         = dd_type;

                using (BAL.DMT_Documents objBAL = new BAL.DMT_Documents())
                {
                    if (objBAL.Insert(model))
                    {
                        GlobalVarible.AddMessage("User document saved successfully.");
                    }
                    else
                    {
                        GlobalVarible.AddError("Unable to save user document");
                    }
                }
            }
            catch (Exception ex)
            {
                GlobalVarible.AddError(ex.Message);
            }

            MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML();
            return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet));
        }
        public JsonResult ApproveRequest(string id)
        {
            GlobalVarible.Clear();
            try
            {
                if (id != null)
                {
                    ENT.DMT_Documents Entity = new ENT.DMT_Documents();

                    using (BAL.DMT_Documents objBAL = new BAL.DMT_Documents())
                    {
                        objBAL.Entity.dd_id = Guid.Parse(id);
                        Entity = (ENT.DMT_Documents)objBAL.GetByPrimaryKey(objBAL.Entity);

                        objBAL.Entity.dd_status       = (int)COM.MyEnumration.DMTDOCUMENTSTATUS.APPROVED;
                        objBAL.Entity.UpdatedBy       = _LoginUserId;
                        objBAL.Entity.UpdatedDateTime = DateTime.Now;

                        if (objBAL.UpdateApprove(objBAL.Entity))
                        {
                            using (BAL.DMT_Approval dMT_Approval = new BAL.DMT_Approval())
                            {
                                dMT_Approval.Entity.approval_userid = Entity.dd_userid;
                                dMT_Approval.Entity.approval_status = (int)COM.MyEnumration.DMTAPPROVALSTATUS.APPROVED;
                                dMT_Approval.Entity.CreatedBy       = _LoginUserId;
                                dMT_Approval.Entity.CreatedDateTime = DateTime.Now;
                                if (dMT_Approval.Insert(dMT_Approval.Entity))
                                {
                                    GlobalVarible.AddMessage("Request Approved Successfully.");
                                }
                            }
                            GlobalVarible.AddMessage("Request Approved Successfully.");
                        }
                        else
                        {
                            GlobalVarible.AddMessage("Unable to Approve Request.");
                        }
                    }
                }
                else
                {
                    GlobalVarible.AddMessage("Unable Approve Request.");
                }
            }
            catch (Exception ex)
            {
                GlobalVarible.AddError(ex.Message);
            }
            MySession.Current.MessageResult.MessageHtml = GlobalVarible.GetMessageHTML();
            return(Json(MySession.Current.MessageResult, JsonRequestBehavior.AllowGet));
        }
Exemple #6
0
        public object GetByPrimaryKey(ENT.DMT_Documents Entity)
        {
            object objResult = null;

            try
            {
                DAL.CRUDOperation tt = new DAL.CRUDOperation();
                objResult = tt.GetEntityByPrimartKey(Entity);
            }
            catch (Exception)
            {
                throw;
            }
            return(objResult);
        }
Exemple #7
0
 public ENT.DMT_Documents GetByUserId(Guid guid)
 {
     ENT.DMT_Documents Entity = new ENT.DMT_Documents();
     Entity = clsDAL.GetByUserId(guid);
     return(Entity);
 }