Ejemplo n.º 1
0
        public void Update([FromBody] dynamic data)
        {
            var jsonString = JsonConvert.SerializeObject(data);
            var dataQuery  = JsonConvert.DeserializeObject <CustomTimeLogDataModel>(jsonString);

            CustomTimeLogDataManager.Update(dataQuery, SessionVariables.RequestProfile);
        }
Ejemplo n.º 2
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new CustomTimeLogDataModel();

            if (values.ContainsKey(CustomTimeLogDataModel.DataColumns.CustomTimeLogId))
            {
                data.CustomTimeLogId = int.Parse(values[CustomTimeLogDataModel.DataColumns.CustomTimeLogId].ToString());
            }

            if (values.ContainsKey(CustomTimeLogDataModel.DataColumns.PersonId))
            {
                data.PersonId = int.Parse(values[CustomTimeLogDataModel.DataColumns.PersonId].ToString());
            }

            if (values.ContainsKey(CustomTimeLogDataModel.DataColumns.PromotedDate))
            {
                data.PromotedDate = DateTime.Parse(values[CustomTimeLogDataModel.DataColumns.PromotedDate].ToString());
            }


            if (values.ContainsKey(CustomTimeLogDataModel.DataColumns.Value))
            {
                data.Value = decimal.Parse(values[CustomTimeLogDataModel.DataColumns.Value].ToString());
            }


            CustomTimeLogDataManager.Update(data, SessionVariables.RequestProfile);
            InlineEditingList.Data = GetData();
        }
Ejemplo n.º 3
0
        public override int?Save(string action)
        {
            var data = new CustomTimeLogDataModel();

            data.CustomTimeLogId      = CustomTimeLogId;
            data.CustomTimeLogKey     = CustomTimeLogKey;
            data.PersonId             = PersonId;
            data.ApplicationId        = ApplicationId;
            data.CustomTimeCategoryId = CustomTimeCategoryId;
            data.PromotedDate         = WorkDate;
            data.Value = NoofFilesPromoted;


            if (action == "Insert")
            {
                var dtCustomTimeLog = CustomTimeLogDataManager.DoesExist(data, SessionVariables.RequestProfile);

                if (dtCustomTimeLog.Rows.Count == 0)
                {
                    var customTimeLogId = CustomTimeLogDataManager.Create(data, SessionVariables.RequestProfile);
                }
                else
                {
                    throw new Exception("Record with given ID already exists.");
                }
            }
            else
            {
                CustomTimeLogDataManager.Update(data, SessionVariables.RequestProfile);
            }

            return(data.CustomTimeLogId);
        }
Ejemplo n.º 4
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();
            var data        = new CustomTimeLogDataModel();

            UpdatedData = CustomTimeLogDataManager.Search(data, SessionVariables.RequestProfile).Clone();
            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.CustomTimeLogId =
                    Convert.ToInt32(SelectedData.Rows[i][CustomTimeLogDataModel.DataColumns.CustomTimeLogId].ToString());

                data.PersonId = !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(CustomTimeLogDataModel.DataColumns.PersonId))
                                        ? int.Parse(CheckAndGetRepeaterTextBoxValue(CustomTimeLogDataModel.DataColumns.PersonId).ToString())
                                        : int.Parse(SelectedData.Rows[i][CustomTimeLogDataModel.DataColumns.PersonId].ToString());

                data.PromotedDate =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(CustomTimeLogDataModel.DataColumns.PromotedDate))
                                        ? DateTime.Parse(CheckAndGetRepeaterTextBoxValue(CustomTimeLogDataModel.DataColumns.PromotedDate).ToString())
                                        : DateTime.Parse(SelectedData.Rows[i][CustomTimeLogDataModel.DataColumns.PromotedDate].ToString());



                data.Value =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(CustomTimeLogDataModel.DataColumns.Value))
                                        ? decimal.Parse(CheckAndGetRepeaterTextBoxValue(CustomTimeLogDataModel.DataColumns.Value).ToString())
                                        : decimal.Parse(SelectedData.Rows[i][CustomTimeLogDataModel.DataColumns.Value].ToString());


                CustomTimeLogDataManager.Update(data, SessionVariables.RequestProfile);
                data = new CustomTimeLogDataModel();
                data.CustomTimeLogId = Convert.ToInt32(SelectedData.Rows[i][CustomTimeLogDataModel.DataColumns.CustomTimeLogId].ToString());
                var dt = CustomTimeLogDataManager.Search(data, SessionVariables.RequestProfile);

                if (dt.Rows.Count == 1)
                {
                    UpdatedData.ImportRow(dt.Rows[0]);
                }
            }
            return(UpdatedData);
        }